Java Code Examples for com.fasterxml.jackson.annotation.JsonTypeInfo#Id
The following examples show how to use
com.fasterxml.jackson.annotation.JsonTypeInfo#Id .
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: NodeMapping.java From haven-platform with Apache License 2.0 | 5 votes |
private String getJsonType(Class<?> clazz, JsonTypeInfo typeInfo) { String value; JsonTypeInfo.Id use = typeInfo.use(); switch (use) { case CLASS: value = clazz.getName(); break; case NAME: { JsonSubTypes.Type needed = null; JsonSubTypes subTypes = AnnotationUtils.findAnnotation(clazz, JsonSubTypes.class); if(subTypes != null) { for(JsonSubTypes.Type type: subTypes.value()) { if(type.value().equals(clazz)) { needed = type; break; } } } if(needed == null) { throw new IllegalArgumentException("On " + clazz + " can not find 'JsonSubTypes' record for current type."); } value = needed.name(); break; } default: throw new IllegalArgumentException("On " + clazz + " find unexpected 'JsonTypeInfo.use' value: " + use); } return value; }
Example 2
Source File: NodeMapping.java From haven-platform with Apache License 2.0 | 5 votes |
private String getPropertyName(JsonTypeInfo typeInfo) { String property = typeInfo.property(); if (property.isEmpty()) { JsonTypeInfo.Id use = typeInfo.use(); property = use.getDefaultPropertyName(); } return property; }
Example 3
Source File: StdTypeResolverBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public StdTypeResolverBuilder init(JsonTypeInfo.Id idType, TypeIdResolver idRes) { // sanity checks if (idType == null) { throw new IllegalArgumentException("idType cannot be null"); } _idType = idType; _customIdResolver = idRes; // Let's also initialize property name as per idType default _typeProperty = idType.getDefaultPropertyName(); return this; }
Example 4
Source File: StdTypeResolverBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
/** * @since 2.9 */ protected StdTypeResolverBuilder(JsonTypeInfo.Id idType, JsonTypeInfo.As idAs, String propName) { _idType = idType; _includeAs = idAs; _typeProperty = propName; }
Example 5
Source File: TypeNameIdResolver.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.NAME; }
Example 6
Source File: CustomTypeIdResolver.java From haven-platform with Apache License 2.0 | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CLASS; }
Example 7
Source File: NsTypeIdResolver.java From components with Apache License 2.0 | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.NAME; }
Example 8
Source File: SpringHandlerInstantiatorTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; }
Example 9
Source File: MinimalClassNameIdResolver.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.MINIMAL_CLASS; }
Example 10
Source File: ClassNameIdResolver.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CLASS; }
Example 11
Source File: SpringHandlerInstantiatorTests.java From spring-analysis-note with MIT License | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; }
Example 12
Source File: LowerCaseClassNameResolver.java From POC with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; }
Example 13
Source File: YahooTypeIdResolver.java From cloudstreetmarket.com with GNU General Public License v3.0 | 4 votes |
public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.NAME; }
Example 14
Source File: LowerCaseClassNameResolver.java From spring-boot-exception-handling with MIT License | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; }
Example 15
Source File: CustomClassIdResolver.java From spring-5-examples with MIT License | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; }
Example 16
Source File: DataEntryTypeResolver.java From WavesJ with MIT License | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; }
Example 17
Source File: MessageTypeResolver.java From Cardshifter with Apache License 2.0 | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; }
Example 18
Source File: ModelTypeResolver.java From omise-java with MIT License | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; }
Example 19
Source File: ApiError.java From spring-boot-akka-event-sourcing-starter with Apache License 2.0 | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; }
Example 20
Source File: SpringHandlerInstantiatorTests.java From java-technology-stack with MIT License | 4 votes |
@Override public JsonTypeInfo.Id getMechanism() { return JsonTypeInfo.Id.CUSTOM; }