public A withDefinition(TypeDef definition) { this.definition = definition; this.fullyQualifiedName = definition.getFullyQualifiedName(); return (A) this; }
public String apply(TypeDef item) { return item.getFullyQualifiedName(); } }, "#");
private static String getKey(TypeDef clazz) { return clazz.getFullyQualifiedName(); } }
public TypeDef registerApi(TypeDef api) { if (api != null) { apis.put(api.getFullyQualifiedName(), api); } return api; }
public TypeDef registerIfAbsent(TypeDef definition) { if (definition != null) { definitions.putIfAbsent(definition.getFullyQualifiedName(), definition); } return definition; }
public TypeDef register(TypeDef buildable) { if (buildable != null) { buildables.put(buildable.getFullyQualifiedName(), buildable); } return buildable; }
public TypeDef registerModel(TypeDef model) { if (model != null) { models.put(model.getFullyQualifiedName(), model); } return model; }
public boolean isBuildable(TypeDef type) { return type != null && buildables.containsKey(type.getFullyQualifiedName()); }
public TypeDef register(TypeDef definition) { definitions.put(definition.getFullyQualifiedName(), definition); return definition; }
/** * Checks if a {@link TypeRef} is a {@link java.util.Optional}. * @param type The type to check. * @return True if its a {@link java.util.Optional}. */ public static boolean isOptional(TypeRef type) { if (!(type instanceof ClassRef)) { return false; } return JAVA_UTIL_OPTIONAL.equals(((ClassRef)type).getDefinition().getFullyQualifiedName()); }
/** * Checks if a {@link TypeRef} is a {@link java.util.OptionalDouble}. * @param type The type to check. * @return True if its a {@link java.util.OptionalDouble}. */ public static boolean isOptionalDouble(TypeRef type) { if (!(type instanceof ClassRef)) { return false; } return JAVA_UTIL_OPTIONAL_DOUBLE.equals(((ClassRef)type).getDefinition().getFullyQualifiedName()); }
public TypeDef getBuildable(TypeRef type) { if (type instanceof ClassRef) { return buildables.get(((ClassRef)type).getDefinition().getFullyQualifiedName()); } return null; }
/** * Checks if a {@link TypeRef} is a {@link java.util.OptionalLong}. * @param type The type to check. * @return True if its a {@link java.util.OptionalLong}. */ public static boolean isOptionalLong(TypeRef type) { if (!(type instanceof ClassRef)) { return false; } return JAVA_UTIL_OPTIONAL_LONG.equals(((ClassRef)type).getDefinition().getFullyQualifiedName()); }
/** * Checks if a {@link TypeRef} is a {@link java.util.OptionalInt}. * @param type The type to check. * @return True if its a {@link java.util.OptionalInt}. */ public static boolean isOptionalInt(TypeRef type) { if (!(type instanceof ClassRef)) { return false; } return JAVA_UTIL_OPTIONAL_INT.equals(((ClassRef)type).getDefinition().getFullyQualifiedName()); }
public TypeDef getApi(TypeRef type) { if (type instanceof ClassRef) { return apis.get(((ClassRef)type).getDefinition().getFullyQualifiedName()); } return null; }
public TypeDef getModel(TypeRef type) { if (type instanceof ClassRef) { return models.get(((ClassRef)type).getDefinition().getFullyQualifiedName()); } return null; }
private static boolean hasPojoAnnotation(TypeDef typeDef) { return typeDef.getAnnotations().stream() .filter(a -> a.getClassRef().getDefinition().getFullyQualifiedName().equals(Pojo.class.getTypeName())) .findAny().isPresent(); }
public void selectAnnotated(RoundEnvironment env, Types types, AnnotationSelector selector, Map<String, TypeDef> definitions) { for (Object o : env.getElementsAnnotatedWith((TypeElement) types.asElement(annotationMirror(selector)))) { if (o instanceof TypeElement) { TypeDef typeDef = new TypeDefBuilder(ElementTo.TYPEDEF.apply(ModelUtils.getClassElement((Element) o))) .build(); definitions.put(typeDef.getFullyQualifiedName(), typeDef); } } }
public String getName() { if (requiresFullyQualifiedName()) { return getDefinition().getFullyQualifiedName(); } return getDefinition().getName(); }
public ClassRef(TypeDef definition, String fullyQualifiedName, int dimensions, List<TypeRef> arguments, Map<AttributeKey, Object> attributes) { super(attributes); this.definition = definition != null ? definition : new TypeDefBuilder().build(); this.dimensions = dimensions; this.arguments = arguments; this.fullyQualifiedName = fullyQualifiedName != null ? fullyQualifiedName : (definition != null ? definition.getFullyQualifiedName() : null); if (definition != null) { DefinitionRepository.getRepository().registerIfAbsent(definition); } }