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; }
.withModifiers(0) .addToAttributes(ORIGIN_TYPEDEF, item) .addToAttributes(OUTER_INTERFACE, fluentType)
.withModifiers(TypeUtils.modifiersToInt(Modifier.PRIVATE)) .addToAttributes(ORIGIN_TYPEDEF, item) .addToAttributes(OUTER_INTERFACE, fluentType)
.withName(name) .withTypeRef(returnType) .withModifiers(TypeUtils.modifiersToInt()) .build()); .withName(StringUtils.toFieldName(name)) .withTypeRef(returnType) .withModifiers(mutable ? TypeUtils.modifiersToInt(Modifier.PRIVATE) : TypeUtils.modifiersToInt(Modifier.PRIVATE, Modifier.FINAL)) .build();
.withName(var.getId().getName()) .withTypeRef(typeRef) .withModifiers(fieldDeclaration.getModifiers()) .addToAttributes(Attributeable.INIT, var.getInit() != null ? var.getInit().toStringWithoutComments() : null) .build()); .withName(parameter.getId().getName()) .withTypeRef(typeRef) .withModifiers(parameter.getModifiers()) .withAnnotations(annotations) .build()); .withName(parameter.getId().getName()) .withTypeRef(typeRef) .withModifiers(parameter.getModifiers()) .withAnnotations(annotations) .build());
.withTypeRef(TypeAs.BUILDER.apply(type).toInternalReference()) .withName(BUILDER) .withModifiers(TypeUtils.modifiersToInt(Modifier.PRIVATE, Modifier.FINAL)) .build(); .withTypeRef(functionType) .withName(FUNCTION) .withModifiers(TypeUtils.modifiersToInt(Modifier.PRIVATE, Modifier.FINAL)) .build();