com.fasterxml.jackson.databind.jsontype.NamedType Java Examples
The following examples show how to use
com.fasterxml.jackson.databind.jsontype.NamedType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DruidStateFactory.java From storm-example with Apache License 2.0 | 6 votes |
private static synchronized void startRealtime() { if (rn == null) { final Lifecycle lifecycle = new Lifecycle(); rn = RealtimeNode.builder().build(); lifecycle.addManagedInstance(rn); rn.registerJacksonSubtype(new NamedType(StormFirehoseFactory.class, "storm")); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { LOG.info("Running shutdown hook"); lifecycle.stop(); } })); try { lifecycle.start(); } catch (Throwable t) { LOG.info("Throwable caught at startup, committing seppuku", t); t.printStackTrace(); System.exit(2); } } }
Example #2
Source File: ExtensionAuthenticatorOutputDeserializer.java From webauthn4j with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public ExtensionAuthenticatorOutput<?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { String name = p.getParsingContext().getCurrentName(); if (name == null) { name = p.getParsingContext().getParent().getCurrentName(); } DeserializationConfig config = ctxt.getConfig(); AnnotatedClass annotatedClass = AnnotatedClassResolver.resolveWithoutSuperTypes(config, ExtensionAuthenticatorOutput.class); Collection<NamedType> namedTypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass(config, annotatedClass); for (NamedType namedType : namedTypes) { if (Objects.equals(namedType.getName(), name)) { return (ExtensionAuthenticatorOutput<?>) ctxt.readValue(p, namedType.getType()); } } logger.warn("Unknown extension '{}' is contained.", name); return ctxt.readValue(p, UnknownExtensionAuthenticatorOutput.class); }
Example #3
Source File: RegistrationExtensionClientInputDeserializer.java From webauthn4j with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public RegistrationExtensionClientInput<?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { String name = p.getParsingContext().getCurrentName(); if (name == null) { name = p.getParsingContext().getParent().getCurrentName(); } DeserializationConfig config = ctxt.getConfig(); AnnotatedClass annotatedClass = AnnotatedClassResolver.resolveWithoutSuperTypes(config, RegistrationExtensionClientInput.class); Collection<NamedType> namedTypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass(config, annotatedClass); for (NamedType namedType : namedTypes) { if (Objects.equals(namedType.getName(), name)) { return (RegistrationExtensionClientInput<?>) ctxt.readValue(p, namedType.getType()); } } logger.warn("Unknown extension '{}' is contained.", name); return ctxt.readValue(p, UnknownExtensionClientInput.class); }
Example #4
Source File: ExtensionClientOutputDeserializer.java From webauthn4j with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public ExtensionClientOutput<?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { String name = p.getParsingContext().getCurrentName(); if (name == null) { name = p.getParsingContext().getParent().getCurrentName(); } DeserializationConfig config = ctxt.getConfig(); AnnotatedClass annotatedClass = AnnotatedClassResolver.resolveWithoutSuperTypes(config, ExtensionClientOutput.class); Collection<NamedType> namedTypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass(config, annotatedClass); for (NamedType namedType : namedTypes) { if (Objects.equals(namedType.getName(), name)) { return (ExtensionClientOutput<?>) ctxt.readValue(p, namedType.getType()); } } logger.warn("Unknown extension '{}' is contained.", name); return ctxt.readValue(p, UnknownExtensionClientOutput.class); }
Example #5
Source File: MomentSketchModule.java From momentsketch with Apache License 2.0 | 6 votes |
@Override public List<? extends Module> getJacksonModules() { return ImmutableList.of( new SimpleModule(getClass().getSimpleName() ).registerSubtypes( new NamedType( MomentSketchAggregatorFactory.class, MomentSketchAggregatorFactory.TYPE_NAME), new NamedType( MomentSketchMergeAggregatorFactory.class, MomentSketchMergeAggregatorFactory.TYPE_NAME), new NamedType( MomentSketchQuantilePostAggregator.class, MomentSketchQuantilePostAggregator.TYPE_NAME) ).addSerializer( MomentSketchWrapper.class, new MomentSketchJsonSerializer() ) ); }
Example #6
Source File: TestUtils.java From foxtrot with Apache License 2.0 | 6 votes |
public static void registerActions(AnalyticsLoader analyticsLoader, ObjectMapper mapper) throws Exception { Reflections reflections = new Reflections("com.flipkart.foxtrot", new SubTypesScanner()); Set<Class<? extends Action>> actions = reflections.getSubTypesOf(Action.class); if(actions.isEmpty()) { throw new Exception("No analytics actions found!!"); } List<NamedType> types = new Vector<>(); for(Class<? extends Action> action : actions) { AnalyticsProvider analyticsProvider = action.getAnnotation(AnalyticsProvider.class); final String opcode = analyticsProvider.opcode(); if(Strings.isNullOrEmpty(opcode)) { throw new Exception("Invalid annotation on " + action.getCanonicalName()); } analyticsLoader.register( new ActionMetadata(analyticsProvider.request(), action, analyticsProvider.cacheable()), analyticsProvider.opcode()); if(analyticsProvider.cacheable()) { analyticsLoader.registerCache(opcode); } types.add(new NamedType(analyticsProvider.request(), opcode)); types.add(new NamedType(analyticsProvider.response(), opcode)); logger.info("Registered action: " + action.getCanonicalName()); } mapper.getSubtypeResolver() .registerSubtypes(types.toArray(new NamedType[types.size()])); }
Example #7
Source File: BeanSerializerFactory.java From bistoury with GNU General Public License v3.0 | 6 votes |
/** * Method called to create a type information serializer for values of given * non-container property * if one is needed. If not needed (no polymorphic handling configured), should * return null. * * @param baseType Declared type to use as the base type for type information serializer * * @return Type serializer to use for property values, if one is needed; null if not. */ public TypeSerializer findPropertyTypeSerializer(JavaType baseType, SerializationConfig config, AnnotatedMember accessor) throws JsonMappingException { AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findPropertyTypeResolver(config, accessor, baseType); TypeSerializer typeSer; // Defaulting: if no annotations on member, check value class if (b == null) { typeSer = createTypeSerializer(config, baseType); } else { Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass( config, accessor, baseType); typeSer = b.buildTypeSerializer(config, baseType, subtypes); } return typeSer; }
Example #8
Source File: AuthenticationExtensionClientInputDeserializer.java From webauthn4j with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public AuthenticationExtensionClientInput<?> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { String name = p.getParsingContext().getCurrentName(); if (name == null) { name = p.getParsingContext().getParent().getCurrentName(); } DeserializationConfig config = ctxt.getConfig(); AnnotatedClass annotatedClass = AnnotatedClassResolver.resolveWithoutSuperTypes(config, AuthenticationExtensionClientInput.class); Collection<NamedType> namedTypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass(config, annotatedClass); for (NamedType namedType : namedTypes) { if (Objects.equals(namedType.getName(), name)) { return (AuthenticationExtensionClientInput<?>) ctxt.readValue(p, namedType.getType()); } } logger.warn("Unknown extension '{}' is contained.", name); return ctxt.readValue(p, UnknownExtensionClientInput.class); }
Example #9
Source File: StdSubtypeResolver.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public Collection<NamedType> collectAndResolveSubtypesByClass(MapperConfig<?> config, AnnotatedClass type) { final AnnotationIntrospector ai = config.getAnnotationIntrospector(); HashMap<NamedType, NamedType> subtypes = new HashMap<NamedType, NamedType>(); // then consider registered subtypes (which have precedence over annotations) if (_registeredSubtypes != null) { Class<?> rawBase = type.getRawType(); for (NamedType subtype : _registeredSubtypes) { // is it a subtype of root type? if (rawBase.isAssignableFrom(subtype.getType())) { // yes AnnotatedClass curr = AnnotatedClassResolver.resolveWithoutSuperTypes(config, subtype.getType()); _collectAndResolve(curr, subtype, config, ai, subtypes); } } } // and then check subtypes via annotations from base type (recursively) NamedType rootType = new NamedType(type.getRawType(), null); _collectAndResolve(type, rootType, config, ai, subtypes); return new ArrayList<NamedType>(subtypes.values()); }
Example #10
Source File: StdSubtypeResolver.java From lams with GNU General Public License v2.0 | 6 votes |
@Override public Collection<NamedType> collectAndResolveSubtypesByTypeId(MapperConfig<?> config, AnnotatedClass baseType) { final Class<?> rawBase = baseType.getRawType(); Set<Class<?>> typesHandled = new HashSet<Class<?>>(); Map<String,NamedType> byName = new LinkedHashMap<String,NamedType>(); NamedType rootType = new NamedType(rawBase, null); _collectAndResolveByTypeId(baseType, rootType, config, typesHandled, byName); if (_registeredSubtypes != null) { for (NamedType subtype : _registeredSubtypes) { // is it a subtype of root type? if (rawBase.isAssignableFrom(subtype.getType())) { // yes AnnotatedClass curr = AnnotatedClassResolver.resolveWithoutSuperTypes(config, subtype.getType()); _collectAndResolveByTypeId(curr, subtype, config, typesHandled, byName); } } } return _combineNamedAndUnnamed(rawBase, typesHandled, byName); }
Example #11
Source File: BeanSerializerFactory.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Method called to create a type information serializer for values of given * non-container property * if one is needed. If not needed (no polymorphic handling configured), should * return null. * * @param baseType Declared type to use as the base type for type information serializer * * @return Type serializer to use for property values, if one is needed; null if not. */ public TypeSerializer findPropertyTypeSerializer(JavaType baseType, SerializationConfig config, AnnotatedMember accessor) throws JsonMappingException { AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findPropertyTypeResolver(config, accessor, baseType); TypeSerializer typeSer; // Defaulting: if no annotations on member, check value class if (b == null) { typeSer = createTypeSerializer(config, baseType); } else { Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass( config, accessor, baseType); typeSer = b.buildTypeSerializer(config, baseType, subtypes); } return typeSer; }
Example #12
Source File: BeanSerializerFactory.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Method called to create a type information serializer for values of given * container property * if one is needed. If not needed (no polymorphic handling configured), should * return null. * * @param containerType Declared type of the container to use as the base type for type information serializer * * @return Type serializer to use for property value contents, if one is needed; null if not. */ public TypeSerializer findPropertyContentTypeSerializer(JavaType containerType, SerializationConfig config, AnnotatedMember accessor) throws JsonMappingException { JavaType contentType = containerType.getContentType(); AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findPropertyContentTypeResolver(config, accessor, containerType); TypeSerializer typeSer; // Defaulting: if no annotations on member, check value class if (b == null) { typeSer = createTypeSerializer(config, contentType); } else { Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass(config, accessor, contentType); typeSer = b.buildTypeSerializer(config, contentType, subtypes); } return typeSer; }
Example #13
Source File: BasicSerializerFactory.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Method called to construct a type serializer for values with given declared * base type. This is called for values other than those of bean property * types. */ @Override public TypeSerializer createTypeSerializer(SerializationConfig config, JavaType baseType) { BeanDescription bean = config.introspectClassAnnotations(baseType.getRawClass()); AnnotatedClass ac = bean.getClassInfo(); AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findTypeResolver(config, ac, baseType); /* Ok: if there is no explicit type info handler, we may want to * use a default. If so, config object knows what to use. */ Collection<NamedType> subtypes = null; if (b == null) { b = config.getDefaultTyper(baseType); } else { subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass(config, ac); } if (b == null) { return null; } // 10-Jun-2015, tatu: Since not created for Bean Property, no need for post-processing // wrt EXTERNAL_PROPERTY return b.buildTypeSerializer(config, baseType, subtypes); }
Example #14
Source File: DruidStateFactory.java From storm-example with Apache License 2.0 | 6 votes |
private static synchronized void startRealtime() { if (rn == null) { final Lifecycle lifecycle = new Lifecycle(); rn = RealtimeNode.builder().build(); lifecycle.addManagedInstance(rn); rn.registerJacksonSubtype(new NamedType(StormFirehoseFactory.class, "storm")); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { LOG.info("Running shutdown hook"); lifecycle.stop(); } })); try { lifecycle.start(); } catch (Throwable t) { LOG.info("Throwable caught at startup, committing seppuku", t); t.printStackTrace(); System.exit(2); } } }
Example #15
Source File: BasicDeserializerFactory.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Method called to create a type information deserializer for values of * given non-container property, if one is needed. * If not needed (no polymorphic handling configured for property), should return null. *<p> * Note that this method is only called for non-container bean properties, * and not for values in container types or root values (or container properties) * * @param baseType Declared base type of the value to deserializer (actual * deserializer type will be this type or its subtype) * * @return Type deserializer to use for given base type, if one is needed; null if not. */ public TypeDeserializer findPropertyTypeDeserializer(DeserializationConfig config, JavaType baseType, AnnotatedMember annotated) throws JsonMappingException { AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findPropertyTypeResolver(config, annotated, baseType); // Defaulting: if no annotations on member, check value class if (b == null) { return findTypeDeserializer(config, baseType); } // but if annotations found, may need to resolve subtypes: Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByTypeId( config, annotated, baseType); return b.buildTypeDeserializer(config, baseType, subtypes); }
Example #16
Source File: BasicDeserializerFactory.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Method called to find and create a type information deserializer for values of * given container (list, array, map) property, if one is needed. * If not needed (no polymorphic handling configured for property), should return null. *<p> * Note that this method is only called for container bean properties, * and not for values in container types or root values (or non-container properties) * * @param containerType Type of property; must be a container type * @param propertyEntity Field or method that contains container property */ public TypeDeserializer findPropertyContentTypeDeserializer(DeserializationConfig config, JavaType containerType, AnnotatedMember propertyEntity) throws JsonMappingException { AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findPropertyContentTypeResolver(config, propertyEntity, containerType); JavaType contentType = containerType.getContentType(); // Defaulting: if no annotations on member, check class if (b == null) { return findTypeDeserializer(config, contentType); } // but if annotations found, may need to resolve subtypes: Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByTypeId( config, propertyEntity, contentType); return b.buildTypeDeserializer(config, contentType, subtypes); }
Example #17
Source File: DynamicConfigApiJsonModule.java From terracotta-platform with Apache License 2.0 | 6 votes |
public DynamicConfigApiJsonModule() { super(DynamicConfigApiJsonModule.class.getSimpleName(), new Version(1, 0, 0, null, null, null)); registerSubtypes( new NamedType(ClusterActivationNomadChange.class, "ClusterActivationNomadChange"), new NamedType(MultiSettingNomadChange.class, "MultiSettingNomadChange"), new NamedType(NodeAdditionNomadChange.class, "NodeAdditionNomadChange"), new NamedType(ClusterActivationNomadChange.class, "ClusterActivationNomadChange"), new NamedType(NodeRemovalNomadChange.class, "NodeRemovalNomadChange"), new NamedType(SettingNomadChange.class, "SettingNomadChange")); setMixInAnnotation(NodeNomadChange.class, NodeNomadChangeMixin.class); setMixInAnnotation(Applicability.class, ApplicabilityMixin.class); setMixInAnnotation(ClusterActivationNomadChange.class, ClusterActivationNomadChangeMixin.class); setMixInAnnotation(MultiSettingNomadChange.class, MultiSettingNomadChangeMixin.class); setMixInAnnotation(NodeAdditionNomadChange.class, NodeAdditionNomadChangeMixin.class); setMixInAnnotation(NodeRemovalNomadChange.class, NodeRemovalNomadChangeMixin.class); setMixInAnnotation(SettingNomadChange.class, SettingNomadChangeMixin.class); }
Example #18
Source File: BeanSerializerFactory.java From bistoury with GNU General Public License v3.0 | 6 votes |
/** * Method called to create a type information serializer for values of given * container property * if one is needed. If not needed (no polymorphic handling configured), should * return null. * * @param containerType Declared type of the container to use as the base type for type information serializer * * @return Type serializer to use for property value contents, if one is needed; null if not. */ public TypeSerializer findPropertyContentTypeSerializer(JavaType containerType, SerializationConfig config, AnnotatedMember accessor) throws JsonMappingException { JavaType contentType = containerType.getContentType(); AnnotationIntrospector ai = config.getAnnotationIntrospector(); TypeResolverBuilder<?> b = ai.findPropertyContentTypeResolver(config, accessor, containerType); TypeSerializer typeSer; // Defaulting: if no annotations on member, check value class if (b == null) { typeSer = createTypeSerializer(config, contentType); } else { Collection<NamedType> subtypes = config.getSubtypeResolver().collectAndResolveSubtypesByClass(config, accessor, contentType); typeSer = b.buildTypeSerializer(config, contentType, subtypes); } return typeSer; }
Example #19
Source File: StdSubtypeResolver.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Helper method used for merging explicitly named types and handled classes * without explicit names. */ protected Collection<NamedType> _combineNamedAndUnnamed(Class<?> rawBase, Set<Class<?>> typesHandled, Map<String,NamedType> byName) { ArrayList<NamedType> result = new ArrayList<NamedType>(byName.values()); // Ok, so... we will figure out which classes have no explicitly assigned name, // by removing Classes from Set. And for remaining classes, add an anonymous // marker for (NamedType t : byName.values()) { typesHandled.remove(t.getType()); } for (Class<?> cls : typesHandled) { // 27-Apr-2017, tatu: [databind#1616] Do not add base type itself unless // it is concrete (or has explicit type name) if ((cls == rawBase) && Modifier.isAbstract(cls.getModifiers())) { continue; } result.add(new NamedType(cls)); } return result; }
Example #20
Source File: DTOTest.java From james-project with Apache License 2.0 | 5 votes |
@BeforeEach void setUp() { objectMapper = new ObjectMapper(); objectMapper.registerModule(new Jdk8Module()); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_ABSENT); objectMapper.registerSubtypes( new NamedType(DLPConfigurationItemsRemovedDTO.class, "dlp-configuration-clear"), new NamedType(DLPConfigurationItemAddedDTO.class, "dlp-configuration-store")); }
Example #21
Source File: KafkaConsumerOffsetFetcher.java From eagle with Apache License 2.0 | 5 votes |
public KafkaConsumerOffsetFetcher(ZKConfig config, String... parameters) { try { this.curator = CuratorFrameworkFactory.newClient(config.zkQuorum, config.zkSessionTimeoutMs, 15000, new RetryNTimes(config.zkRetryTimes, config.zkRetryInterval)); curator.start(); this.zkRoot = config.zkRoot; mapper = new ObjectMapper(); Module module = new SimpleModule("offset").registerSubtypes(new NamedType(KafkaConsumerOffset.class)); mapper.registerModule(module); zkPathToPartition = String.format(config.zkRoot, parameters); } catch (Exception e) { throw new RuntimeException(e); } }
Example #22
Source File: QueryTest.java From heroic with Apache License 2.0 | 5 votes |
@Before public void setup() { mapper = new ObjectMapper(); mapper.addMixIn(Aggregation.class, TypeNameMixin.class); mapper.registerModule(new Jdk8Module()); mapper.registerSubtypes(new NamedType(Group.class, Group.NAME)); mapper.registerSubtypes(new NamedType(Empty.class, Empty.NAME)); }
Example #23
Source File: DropwizardModule.java From airpal with Apache License 2.0 | 5 votes |
@Singleton @Provides protected ObjectMapper provideObjectMapper() { ObjectMapper mapper = environment.getObjectMapper(); mapper.registerSubtypes( new NamedType(CSVPersistentOutput.class, "csv"), new NamedType(HiveTablePersistentOutput.class, "hive") ); Rosetta.getMapper().disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); Rosetta.getMapper().enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES); return mapper; }
Example #24
Source File: ImmutableSubtypeResolver.java From bootique with Apache License 2.0 | 5 votes |
@Override public void registerSubtypes(NamedType... types) { if (locked) { throw new UnsupportedOperationException("This object is immutable"); } else { super.registerSubtypes(types); } }
Example #25
Source File: MetadataTypeResolver.java From fahrschein with Apache License 2.0 | 5 votes |
@Override public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { final TypeNameIdResolver typeNameIdResolver = TypeNameIdResolver.construct(config, baseType, subtypes, false, true); return new MetadataTypeDeserializer( baseType, typeNameIdResolver, this.defaultImpl == null ? null : config.getTypeFactory().constructSpecializedType(baseType, this.defaultImpl)); }
Example #26
Source File: AnnotationIntrospector.java From graphql-spqr with Apache License 2.0 | 5 votes |
@Override public List<NamedType> findSubtypes(Annotated a) { List<NamedType> original = super.findSubtypes(a); if ((original == null || original.isEmpty()) && typeMap.containsKey(a.getRawType())) { return typeMap.get(a.getRawType()); } return original; }
Example #27
Source File: JacksonValueMapperFactory.java From graphql-spqr with Apache License 2.0 | 5 votes |
private Module getAnnotationIntrospectorModule(Map<Class, Class> unambiguousTypes, Map<Type, List<NamedType>> ambiguousTypes, MessageBundle messageBundle) { SimpleModule module = new SimpleModule("graphql-spqr-annotation-introspector") { @Override public void setupModule(SetupContext context) { super.setupModule(context); context.insertAnnotationIntrospector(new AnnotationIntrospector(ambiguousTypes, messageBundle)); } }; unambiguousTypes.forEach(module::addAbstractTypeMapping); return module; }
Example #28
Source File: JacksonUtil.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
/** * */ private static void register(ObjectMapper mapper, JacksonMapping mapping) { try { Class<?> clazz = Class.forName(mapping.getClassName()); mapper.registerSubtypes(new NamedType(clazz, mapping.getName())); } catch (ClassNotFoundException e) { throw new JRRuntimeException(e); } }
Example #29
Source File: JsonUtils.java From spring-credhub with Apache License 2.0 | 5 votes |
/** * Configure type mapping for the {@literal value} field in the * {@literal CredentialDetails} object. * @param objectMapper the {@link ObjectMapper} to configure */ private static void configureCredentialDetailTypeMapping(ObjectMapper objectMapper) { List<NamedType> subtypes = new ArrayList<>(); for (CredentialType type : CredentialType.values()) { subtypes.add(new NamedType(type.getModelClass(), type.getValueType())); } registerSubtypes(objectMapper, subtypes); }
Example #30
Source File: SpringHandlerInstantiatorTests.java From spring-analysis-note with MIT License | 5 votes |
@Override public TypeSerializer buildTypeSerializer(SerializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { isAutowiredFiledInitialized = (this.capitalizer != null); return super.buildTypeSerializer(config, baseType, subtypes); }