Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.type;
 
Type that represents Java Collection types (Lists, Sets).
 
 public final class CollectionType
     extends CollectionLikeType
    private static final long serialVersionUID = 7218006718717444365L;
    /*
    /**********************************************************
    /* Life-cycle
    /**********************************************************
     */
    private CollectionType(Class<?> collTJavaType elemT,
            Object valueHandlerObject typeHandler)
    {
        super(collT,  elemTvalueHandlertypeHandler);
    }
    @Override
    protected JavaType _narrow(Class<?> subclass) {
        return new CollectionType(subclassnullnull);
    }
    @Override
    public JavaType narrowContentsBy(Class<?> contentClass)
    {
        // Can do a quick check first:
        if (contentClass == .getRawClass()) {
            return this;
        }
        return new CollectionType(.narrowBy(contentClass),
                );
    }
    @Override
    public JavaType widenContentsBy(Class<?> contentClass)
    {
        // Can do a quick check first:
        if (contentClass == .getRawClass()) {
            return this;
        }
        return new CollectionType(.widenBy(contentClass),
                );
    }
    
    public static CollectionType construct(Class<?> rawTypeJavaType elemT)
    {
        // nominally component types will be just Object.class
        return new CollectionType(rawTypeelemTnullnull);
    }
    // Since 1.7:
    @Override
    public CollectionType withTypeHandler(Object h) {
        return new CollectionType(h);
    }
    // Since 1.7:
    @Override
    {
        return new CollectionType(.withTypeHandler(h),
                );
    }
    // Since 1.9:
    @Override
    public CollectionType withValueHandler(Object h) {
        return new CollectionType(h);
    }
    // Since 1.9:
    @Override
        return new CollectionType(.withValueHandler(h),
                );
    }
    
    /*
    /**********************************************************
    /* Standard methods
    /**********************************************************
     */
    @Override
    public String toString()
    {
        return "[collection type; class "+.getName()+", contains "++"]";
    }
New to GrepCode? Check out our FAQ X