/** * All properties (including inherited). * @param typeDef The type. * @return A list with all properties. */ public static List<Property> allProperties(TypeDef typeDef) { return unrollHierarchy(typeDef) .stream() .flatMap(h -> h.getProperties().stream()) .collect(Collectors.toList()); }
/** * Checks if property exists on the specified type. * @param typeDef The type. * @param property The property name. * @return True if method is found, false otherwise. */ public static boolean hasProperty(TypeDef typeDef, String property) { return unrollHierarchy(typeDef) .stream() .flatMap(h -> h.getProperties().stream()) .filter(p -> property.equals(p.getName())) .findAny() .isPresent(); }
public static Set<String> allGenericsOf(TypeDef clazz) { Set<String> result = new HashSet<String>(); for (TypeParamDef paramDef : clazz.getParameters()) { result.add(paramDef.getName()); } for (Property property : clazz.getProperties()) { result.addAll(allGenericsOf(property)); } for (Method method : clazz.getMethods()) { result.addAll(allGenericsOf(method)); } return result; }
for (Property property : target.getProperties()) { if (!hasBuildableConstructorWithArgument(target, property) && Setter.has(target, property)) { String withName = "with" + property.getNameCapitalized();
for (Property property : c.getProperties()) { if (!hasBuildableConstructorWithArgument(c, property) && Setter.has(c, property)) { String setterName = "set" + property.getNameCapitalized();
if (m.getReturnType() instanceof ClassRef) { ClassRef ref = (ClassRef) m.getReturnType(); Boolean hasSuperClass = pojo.getProperties() .stream() .filter(p -> p.getTypeRef() instanceof ClassRef && p.getName().equals(Getter.propertyNameSafe(m)))
public TypeDef apply(TypeDef... items) { if (items == null || items.length == 0) { throw new IllegalArgumentException("Items cannot be empty."); } else if (items.length == 1) { return items[0]; } else if (items.length == 2) { TypeDef mergedType = TYPES.apply(new TypeDef[]{items[0], items[1]}); TypeDefBuilder builder = new TypeDefBuilder(mergedType); for (Method constructor : items[1].getConstructors()) { builder = builder.addToConstructors(constructor); } for (Method method : items[1].getMethods()) { builder = builder.addToMethods(method); } for (Property property : items[1].getProperties()) { builder = builder.addToProperties(property); } return builder.build(); } else { TypeDef[] rest = new TypeDef[items.length - 1]; System.arraycopy(items, 1, rest, 0, rest.length); CLASSES.apply(new TypeDef[]{items[0], CLASSES.apply(rest)}); } return null; } };
for (Property property : item.getProperties()) { final TypeRef unwrapped = TypeAs.combine(TypeAs.UNWRAP_ARRAY_OF, TypeAs.UNWRAP_COLLECTION_OF, TypeAs.UNWRAP_OPTIONAL_OF).apply(property.getTypeRef()); if (property.isStatic()) {
constructors.add(instanceConstructor); for (final Property property : item.getProperties()) { final TypeRef unwrapped = TypeAs.combine(TypeAs.UNWRAP_ARRAY_OF, TypeAs.UNWRAP_COLLECTION_OF, TypeAs.UNWRAP_OPTIONAL_OF).apply(property.getTypeRef());
public TypeDefFluentImpl(TypeDef instance){ this.withKind(instance.getKind()); this.withPackageName(instance.getPackageName()); this.withName(instance.getName()); this.withComments(instance.getComments()); this.withAnnotations(instance.getAnnotations()); this.withExtendsList(instance.getExtendsList()); this.withImplementsList(instance.getImplementsList()); this.withParameters(instance.getParameters()); this.withProperties(instance.getProperties()); this.withConstructors(instance.getConstructors()); this.withMethods(instance.getMethods()); this.withOuterType(instance.getOuterType()); this.withInnerTypes(instance.getInnerTypes()); this.withModifiers(instance.getModifiers()); this.withAttributes(instance.getAttributes()); }
public TypeDefBuilder(TypeDef instance,Boolean validationEnabled){ this.fluent = this; this.withKind(instance.getKind()); this.withPackageName(instance.getPackageName()); this.withName(instance.getName()); this.withComments(instance.getComments()); this.withAnnotations(instance.getAnnotations()); this.withExtendsList(instance.getExtendsList()); this.withImplementsList(instance.getImplementsList()); this.withParameters(instance.getParameters()); this.withProperties(instance.getProperties()); this.withConstructors(instance.getConstructors()); this.withMethods(instance.getMethods()); this.withOuterType(instance.getOuterType()); this.withInnerTypes(instance.getInnerTypes()); this.withModifiers(instance.getModifiers()); this.withAttributes(instance.getAttributes()); this.validationEnabled = validationEnabled; }
public TypeDefBuilder(TypeDefFluent<?> fluent,TypeDef instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withKind(instance.getKind()); fluent.withPackageName(instance.getPackageName()); fluent.withName(instance.getName()); fluent.withComments(instance.getComments()); fluent.withAnnotations(instance.getAnnotations()); fluent.withExtendsList(instance.getExtendsList()); fluent.withImplementsList(instance.getImplementsList()); fluent.withParameters(instance.getParameters()); fluent.withProperties(instance.getProperties()); fluent.withConstructors(instance.getConstructors()); fluent.withMethods(instance.getMethods()); fluent.withOuterType(instance.getOuterType()); fluent.withInnerTypes(instance.getInnerTypes()); fluent.withModifiers(instance.getModifiers()); fluent.withAttributes(instance.getAttributes()); this.validationEnabled = validationEnabled; } public TypeDefBuilder(TypeDef instance){