public FactoryBasedEnumDeserializer(Class<?> cls, AnnotatedMethod f, JavaType paramType, ValueInstantiator valueInstantiator, SettableBeanProperty[] creatorProps) { super(cls); _factory = f; _hasArgs = true; // We'll skip case of `String`, as well as no type (zero-args): _inputType = paramType.hasRawClass(String.class) ? null : paramType; _deser = null; _valueInstantiator = valueInstantiator; _creatorProps = creatorProps; }
/** * Method that will find all sub-classes and implemented interfaces * of a given class or interface. Classes are listed in order of * precedence, starting with the immediate super-class, followed by * interfaces class directly declares to implemented, and then recursively * followed by parent of super-class and so forth. * Note that <code>Object.class</code> is not included in the list * regardless of whether <code>endBefore</code> argument is defined or not. * * @param endBefore Super-type to NOT include in results, if any; when * encountered, will be ignored (and no super types are checked). * * @since 2.7 */ public static List<JavaType> findSuperTypes(JavaType type, Class<?> endBefore, boolean addClassItself) { if ((type == null) || type.hasRawClass(endBefore) || type.hasRawClass(Object.class)) { return Collections.emptyList(); } List<JavaType> result = new ArrayList<JavaType>(8); _addSuperTypes(type, endBefore, result, addClassItself); return result; }
public static JsonDeserializer<?> findForMap(DeserializationContext ctxt, JavaType type) throws JsonMappingException { JavaUtilCollectionsConverter conv; // 10-Jan-2017, tatu: Some types from `java.util.Collections`/`java.util.Arrays` need bit of help... if (type.hasRawClass(CLASS_SINGLETON_MAP)) { conv = converter(TYPE_SINGLETON_MAP, type, Map.class); } else if (type.hasRawClass(CLASS_UNMODIFIABLE_MAP)) { conv = converter(TYPE_UNMODIFIABLE_MAP, type, Map.class); } else { return null; } return new StdDelegatingDeserializer<Object>(conv); }
public static JsonDeserializer<?> findForCollection(DeserializationContext ctxt, JavaType type) throws JsonMappingException { JavaUtilCollectionsConverter conv; // 10-Jan-2017, tatu: Some types from `java.util.Collections`/`java.util.Arrays` need bit of help... if (type.hasRawClass(CLASS_AS_ARRAYS_LIST)) { conv = converter(TYPE_AS_LIST, type, List.class); } else if (type.hasRawClass(CLASS_SINGLETON_LIST)) { conv = converter(TYPE_SINGLETON_LIST, type, List.class); } else if (type.hasRawClass(CLASS_SINGLETON_SET)) { conv = converter(TYPE_SINGLETON_SET, type, Set.class); } else if (type.hasRawClass(CLASS_UNMODIFIABLE_LIST)) { conv = converter(TYPE_UNMODIFIABLE_LIST, type, List.class); } else if (type.hasRawClass(CLASS_UNMODIFIABLE_SET)) { conv = converter(TYPE_UNMODIFIABLE_SET, type, Set.class); } else { return null; } return new StdDelegatingDeserializer<Object>(conv); }
protected JavaType _findRemappedType(DeserializationConfig config, Class<?> rawType) throws JsonMappingException { JavaType type = mapAbstractType(config, config.constructType(rawType)); return (type == null || type.hasRawClass(rawType)) ? null : type; }
private boolean _primitiveAndWrapper(JavaType baseType, Class<?> refinement) { if (baseType.isPrimitive()) { return baseType.hasRawClass(ClassUtil.primitiveType(refinement)); } if (refinement.isPrimitive()) { return refinement == ClassUtil.primitiveType(baseType.getRawClass()); } return false; } }
/** * Constructor used by {@link ObjectMapper} for initial instantiation */ protected ObjectWriter(ObjectMapper mapper, SerializationConfig config, JavaType rootType, PrettyPrinter pp) { _config = config; _serializerProvider = mapper._serializerProvider; _serializerFactory = mapper._serializerFactory; _generatorFactory = mapper._jsonFactory; _generatorSettings = (pp == null) ? GeneratorSettings.empty : new GeneratorSettings(pp, null, null, null); // 29-Apr-2014, tatu: There is no "untyped serializer", so: if (rootType == null || rootType.hasRawClass(Object.class)) { _prefetch = Prefetch.empty; } else { rootType = rootType.withStaticTyping(); _prefetch = Prefetch.empty.forRootType(this, rootType); } }
if (exp.hasRawClass(Object.class)) { continue; if (sourceType.hasRawClass(Map.class) && act.hasRawClass(Object.class)) { continue;
/** * Method that will find abstract type mapping for specified type, doing a single * lookup through registered abstract type resolvers; will not do recursive lookups. */ private JavaType _mapAbstractType2(DeserializationConfig config, JavaType type) throws JsonMappingException { Class<?> currClass = type.getRawClass(); if (_factoryConfig.hasAbstractTypeResolvers()) { for (AbstractTypeResolver resolver : _factoryConfig.abstractTypeResolvers()) { JavaType concrete = resolver.findTypeMapping(config, type); if ((concrete != null) && !concrete.hasRawClass(currClass)) { return concrete; } } } return null; }
defaultImpl = config.getTypeFactory().constructType(_defaultImpl); } else { if (baseType.hasRawClass(_defaultImpl)) { // common enough to check defaultImpl = baseType; } else if (baseType.isTypeOrSuperTypeOf(_defaultImpl)) {
if (type.hasRawClass(serClass)) { final Class<?> keyClass = (jsonSer == null) ? null : _classIfExplicit(jsonSer.keyAs()); if (keyClass != null) { if (keyType.hasRawClass(keyClass)) { keyType = keyType.withStaticTyping(); } else { if (contentType.hasRawClass(contentClass)) { contentType = contentType.withStaticTyping(); } else {
if ((valueClass != null) && !type.hasRawClass(valueClass) && !_primitiveAndWrapper(type, valueClass)) { try {
if (type.hasRawClass(Void.class)) { return null;
if (type.hasRawClass(Void.class)) { return null;
} else { // changes; assume static typing; plus, need to re-introspect if class differs staticTyping = true; if (!type.hasRawClass(origType.getRawClass())) { beanDesc = config.introspect(type); if (!delegateType.hasRawClass(type.getRawClass())) { beanDesc = config.introspect(delegateType);
if (contentType.hasRawClass(String.class)) {
if ((defaultType != null) && !defaultType.hasRawClass(baseType.getRawClass())) { b = b.defaultImpl(defaultType.getRawClass());
static boolean isResource(JavaType type) { return type.containedType(0).hasRawClass(Resource.class); }
if (!delegateType.hasRawClass(type.getRawClass())) { beanDesc = config.introspect(delegateType);
if (typeProp.getType().hasRawClass(String.class)) { v = typeId; } else {