public boolean matchesUntyped(JavaType key) { return !_isTyped && key.equals(_type); } }
public boolean matchesTyped(JavaType key) { return _isTyped && key.equals(_type); }
@Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; ArrayType other = (ArrayType) o; return _componentType.equals(other._componentType); } }
@Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; ReferenceType other = (ReferenceType) o; if (other._class != _class) return false; // Otherwise actually mostly worry about referenced type return _referencedType.equals(other._referencedType); } }
@Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; CollectionLikeType other = (CollectionLikeType) o; return (_class == other._class) && _elementType.equals(other._elementType); }
@Override public final boolean equals(Object o) { if (o == null) return false; if (o == this) return true; if (o.getClass() != getClass()) { return false; } TypeKey other = (TypeKey) o; if (other._isTyped == _isTyped) { if (_class != null) { return other._class == _class; } return _type.equals(other._type); } return false; } }
@Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; AsKey other = (AsKey) o; if ((_hash == other._hash) && (_raw == other._raw)) { final JavaType[] otherParams = other._params; final int len = _params.length; if (len == otherParams.length) { for (int i = 0; i < len; ++i) { if (!_params[i].equals(otherParams[i])) { return false; } } return true; } } return false; }
@Override public boolean equals(Object o) { if (o == this) return true; if (!ClassUtil.hasClass(o, getClass())) { return false; } TypeBindings other = (TypeBindings) o; int len = _types.length; if (len != other.size()) { return false; } JavaType[] otherTypes = other._types; for (int i = 0; i < len; ++i) { if (!otherTypes[i].equals(_types[i])) { return false; } } return true; }
/** * 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; }
/** * Method for constructing a new reader instance that is configured * to data bind into specified type. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. * * @since 2.5 */ public ObjectReader forType(JavaType valueType) { if (valueType != null && valueType.equals(_valueType)) { return this; } JsonDeserializer<Object> rootDeser = _prefetchRootDeserializer(valueType); // type is stored here, no need to make a copy of config DataFormatReaders det = _dataFormatReaders; if (det != null) { det = det.withType(valueType); } return _new(this, _config, valueType, rootDeser, _valueToUpdate, _schema, _injectableValues, det); }
/** * 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; }
if (newType.equals(rootType)) { return this;
@Override public boolean equals(Object o) { if (o == this) return true; if (o == null) return false; if (o.getClass() != getClass()) return false; ArrayType other = (ArrayType) o; return _componentType.equals(other._componentType); } }
private static List<BeanPropertyWriter> getCurieProperties(List<BeanPropertyWriter> properties) { final List<BeanPropertyWriter> curieProperties = new ArrayList<>(); for (BeanPropertyWriter property : properties) { final JavaType type = property.getType(); if (JavaTypes.CURIE.equals(type) || JavaTypes.isIterableCurieType(type)) { curieProperties.add(property); } } return curieProperties; }
private static boolean isLinkType(BeanPropertyWriter property) { final JavaType type = property.getType(); if (JavaTypes.LINK.equals(type)) { return true; } else if (JavaTypes.isIterableLinkType(type)) { return false; } else { throw new IllegalArgumentException( String.format("BeanPropertyWriter must refer to a type of: %s or an Iterable thereof", Link.class)); } } }
@Override public JsonSerializer<?> modifyMapSerializer(SerializationConfig config, MapType valueType, BeanDescription beanDesc, JsonSerializer<?> serializer) { if (valueType.getKeyType().equals(SimpleType.construct(String.class))) { return new DelegatingMapSerializer(serializer); } return serializer; } });