com.fasterxml.jackson.databind.JavaType#equals ( )源码实例Demo

下面列出了com.fasterxml.jackson.databind.JavaType#equals ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lams   文件: TypeFactory.java
/**
 * Method for constructing a {@link CollectionType}.
 *<p>
 * NOTE: type modifiers are NOT called on Collection type itself; but are called
 * for contained types.
 */
public CollectionType constructCollectionType(Class<? extends Collection> collectionClass,
        JavaType elementType)
{
    TypeBindings bindings = TypeBindings.createIfNeeded(collectionClass, elementType);
    CollectionType result = (CollectionType) _fromClass(null, collectionClass, bindings);
    // 17-May-2017, tatu: As per [databind#1415], we better verify bound values if (but only if)
    //    type being resolved was non-generic (i.e.element type was ignored)
    if (bindings.isEmpty() && (elementType != null)) {
        JavaType t = result.findSuperType(Collection.class);
        JavaType realET = t.getContentType();
        if (!realET.equals(elementType)) {
            throw new IllegalArgumentException(String.format(
                    "Non-generic Collection class %s did not resolve to something with element type %s but %s ",
                    ClassUtil.nameOf(collectionClass), elementType, realET));
        }
    }
    return result;
}
 
源代码2 项目: lams   文件: TypeFactory.java
/**
 * Method for constructing a {@link MapType} instance
 *<p>
 * NOTE: type modifiers are NOT called on constructed type itself; but are called
 * for contained types.
 */
public MapType constructMapType(Class<? extends Map> mapClass, JavaType keyType, JavaType valueType) {
    TypeBindings bindings = TypeBindings.createIfNeeded(mapClass, new JavaType[] { keyType, valueType });
    MapType result = (MapType) _fromClass(null, mapClass, bindings);
    // 17-May-2017, tatu: As per [databind#1415], we better verify bound values if (but only if)
    //    type being resolved was non-generic (i.e.element type was ignored)
    if (bindings.isEmpty()) {
        JavaType t = result.findSuperType(Map.class);
        JavaType realKT = t.getKeyType();
        if (!realKT.equals(keyType)) {
            throw new IllegalArgumentException(String.format(
                    "Non-generic Map class %s did not resolve to something with key type %s but %s ",
                    ClassUtil.nameOf(mapClass), keyType, realKT));
        }
        JavaType realVT = t.getContentType();
        if (!realVT.equals(valueType)) {
            throw new IllegalArgumentException(String.format(
                    "Non-generic Map class %s did not resolve to something with value type %s but %s ",
                    ClassUtil.nameOf(mapClass), valueType, realVT));
        }
    }
    return result;
}
 
源代码3 项目: lams   文件: ReadOnlyClassToSerializerMap.java
public boolean matchesTyped(JavaType key) {
    return _isTyped && key.equals(_type);
}
 
源代码4 项目: lams   文件: ReadOnlyClassToSerializerMap.java
public boolean matchesUntyped(JavaType key) {
    return !_isTyped && key.equals(_type);
}