private static Set<Property> getProperties(Class item) { Set<Property> properties = new HashSet<Property>(); for (Field field : item.getDeclaredFields()) { List<AnnotationRef> annotationRefs = new ArrayList<AnnotationRef>(); for (Annotation annotation : field.getDeclaredAnnotations()) { annotationRefs.add(ANNOTATIONTYPEREF.apply(annotation.annotationType())); } field.getDeclaringClass(); properties.add(new PropertyBuilder() .withName(field.getName()) .withModifiers(field.getModifiers()) .withAnnotations(annotationRefs) .withTypeRef(TYPEREF.apply(field.getDeclaringClass())) .build()); } return properties; }
public Property apply(final VariableElement variableElement) { String name = variableElement.getSimpleName().toString(); TypeRef type = MIRROR_TO_TYPEREF.apply(variableElement.asType()); List<AnnotationRef> annotations = new ArrayList<AnnotationRef>(); for (AnnotationMirror annotationMirror : variableElement.getAnnotationMirrors()) { annotations.add(ANNOTATION_REF.apply(annotationMirror)); } return new PropertyBuilder() .withName(name) .withTypeRef(type) .withAnnotations(annotations) .withModifiers(TypeUtils.modifiersToInt(variableElement.getModifiers())) .build(); } };
public PropertyBuilder(Property instance, Boolean validationEnabled) { this.fluent = this; this.withAnnotations(instance.getAnnotations()); this.withTypeRef(instance.getTypeRef()); this.withName(instance.getName()); this.withModifiers(instance.getModifiers()); this.withAttributes(instance.getAttributes()); this.validationEnabled = validationEnabled; }
.withTypeRef(typeRef) .withModifiers(parameter.getModifiers()) .withAnnotations(annotations) .build()); .withTypeRef(typeRef) .withModifiers(parameter.getModifiers()) .withAnnotations(annotations) .build());