@Override public List<NamedType> findSubtypes(Annotated a) { JsonSubTypes t = a.getAnnotation(JsonSubTypes.class); if (t == null) return null; JsonSubTypes.Type[] types = t.value(); ArrayList<NamedType> result = new ArrayList<NamedType>(types.length); for (JsonSubTypes.Type type : types) { result.add(new NamedType(type.value(), type.name())); } return result; }
@Override public List<NamedType> findSubtypes(Annotated a) { JsonSubTypes t = a.getAnnotation(JsonSubTypes.class); if (t == null) return null; JsonSubTypes.Type[] types = t.value(); ArrayList<NamedType> result = new ArrayList<NamedType>(types.length); for (JsonSubTypes.Type type : types) { result.add(new NamedType(type.value(), type.name())); } return result; }
public boolean isHasSubTypes() { JsonSubTypes subtypes = getAnnotation(JsonSubTypes.class); return subtypes != null && subtypes.value().length > 0; }
public boolean isHasSubTypes() { JsonSubTypes subtypes = getAnnotation(JsonSubTypes.class); return subtypes != null && subtypes.value().length > 0; }
@Override public List<NamedType> findSubtypes(Annotated a) { JsonSubTypes t = a.getAnnotation(JsonSubTypes.class); if (t == null) return null; JsonSubTypes.Type[] types = t.value(); ArrayList<NamedType> result = new ArrayList<NamedType>(types.length); for (JsonSubTypes.Type type : types) { result.add(new NamedType(type.value(), type.name())); } return result; }
@Override public List<NamedType> findSubtypes(Annotated a) { JsonSubTypes t = a.getAnnotation(JsonSubTypes.class); if (t == null) return null; JsonSubTypes.Type[] types = t.value(); ArrayList<NamedType> result = new ArrayList<NamedType>(types.length); for (JsonSubTypes.Type type : types) { result.add(new NamedType(type.value(), type.name())); } return result; }
@Override public List<NamedType> findSubtypes(Annotated a) { JsonSubTypes t = a.getAnnotation(JsonSubTypes.class); if (t == null) return null; JsonSubTypes.Type[] types = t.value(); ArrayList<NamedType> result = new ArrayList<NamedType>(types.length); for (JsonSubTypes.Type type : types) { result.add(new NamedType(type.value(), type.name())); } return result; }
if (info != null) { subtypes = new TreeMap<>(); for (JsonSubTypes.Type type : info.value()) { DecoratedTypeMirror t; TypeElement te;
if (info != null) { subtypes = new TreeMap<>(); for (JsonSubTypes.Type type : info.value()) { DecoratedTypeMirror t; TypeElement te;
public String getTypeIdValue() { List<JsonSubTypes> subTypes = AnnotationUtils.getAnnotations(JsonSubTypes.class, this); if (!subTypes.isEmpty()) { final Types typeUtils = env.getTypeUtils(); for (JsonSubTypes.Type type : subTypes.get(0).value()) { DecoratedTypeMirror decoratedType = Annotations.mirrorOf(type::value, env); if (typeUtils.isSameType(asType(), decoratedType.getDelegate())) { if (!type.name().isEmpty()) { return type.name(); } } } } JsonTypeName typeName = getAnnotation(JsonTypeName.class); if (typeName != null && !typeName.value().isEmpty()) { return typeName.value(); } return isAbstract() ? "..." : getSimpleName().toString(); }
public String getTypeIdValue() { List<JsonSubTypes> subTypes = AnnotationUtils.getAnnotations(JsonSubTypes.class, this); if (!subTypes.isEmpty()) { final Types typeUtils = env.getTypeUtils(); for (JsonSubTypes.Type type : subTypes.get(0).value()) { DecoratedTypeMirror decoratedType = Annotations.mirrorOf(type::value, env); if (typeUtils.isSameType(asType(), decoratedType.getDelegate())) { if (!type.name().isEmpty()) { return type.name(); } } } } JsonTypeName typeName = getAnnotation(JsonTypeName.class); if (typeName != null && !typeName.value().isEmpty()) { return typeName.value(); } return isAbstract() ? "..." : getSimpleName().toString(); }
Elements elementUtils = getContext().getProcessingEnvironment().getElementUtils(); Types typeUtils = getContext().getProcessingEnvironment().getTypeUtils(); JsonSubTypes.Type[] types = subTypes.value(); for (JsonSubTypes.Type type : types) { try {
for (JsonSubTypes.Type type : jsonSubTypes.value()) { addBeanToQueue(new SourceType<>(type.value(), sourceClass.type, "<subClass>"));
Elements elementUtils = getContext().getProcessingEnvironment().getElementUtils(); Types typeUtils = getContext().getProcessingEnvironment().getTypeUtils(); JsonSubTypes.Type[] types = subTypes.value(); for (JsonSubTypes.Type type : types) { try {
private String findSpecifiedTypeInfoValue(Member member, String specifiedType, TypeDefinition type) { if (type == null) { return null; } else if (type.getTypeIdType() == JsonTypeInfo.Id.NAME && member.getSimpleName().toString().equals(type.getTypeIdProperty())) { JsonSubTypes subTypes = type.getAnnotation(JsonSubTypes.class); if (subTypes != null) { for (final JsonSubTypes.Type element : subTypes.value()) { DecoratedTypeMirror choiceType = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return element.value(); } }, type.getContext().getContext().getProcessingEnvironment()); if (choiceType.isInstanceOf(specifiedType)) { return element.name(); } } return null; } } JsonType supertype = type instanceof ObjectTypeDefinition ? ((ObjectTypeDefinition)type).getSupertype() : null; if (supertype instanceof JsonClassType) { return findSpecifiedTypeInfoValue(member, specifiedType, ((JsonClassType) supertype).getTypeDefinition()); } return null; }
private String findSpecifiedTypeInfoValue(Member member, String specifiedType, TypeDefinition type) { if (type == null) { return null; } else if (type.getTypeIdType() == JsonTypeInfo.Id.NAME && member.getSimpleName().toString().equals(type.getTypeIdProperty())) { JsonSubTypes subTypes = type.getAnnotation(JsonSubTypes.class); if (subTypes != null) { for (final JsonSubTypes.Type element : subTypes.value()) { DecoratedTypeMirror choiceType = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return element.value(); } }, type.getContext().getContext().getProcessingEnvironment()); if (choiceType.isInstanceOf(specifiedType)) { return element.name(); } } return null; } } JsonType supertype = type instanceof ObjectTypeDefinition ? ((ObjectTypeDefinition)type).getSupertype() : null; if (supertype instanceof JsonClassType) { return findSpecifiedTypeInfoValue(member, specifiedType, ((JsonClassType) supertype).getTypeDefinition()); } return null; }