@Override public String apply(AnnotationInfo input) { return input.simpleName(); }
private String defaultValue() { return whenAbsentAnnotation.get() .stringValue("value") .get(); }
@Override public boolean isEqual(AnnotationInfo that) { return Testables.isEqualHelper() .equal(packageInfo(), that.packageInfo()) .equal(accessInfo(), that.accessInfo()) .equal(name(), that.name()) .equal(annotationValueInfoMap(), that.annotationValueInfoMap()) .equal(enclosingTypeInfo(), that.enclosingTypeInfo()) .equal(annotationInfoMap(), that.annotationInfoMap()) .result(); }
public BuilderProperty builderProperty() { return fieldAnnotation.annotationInfo(FieldAnnotation.class) .get() .booleanValue("builder", false) ? property.standardBuilderProperty() : BuilderProperty.ignore(); }
<E extends Enum<E>> E fieldAnnotationEnumValue(String name, Class<E> enumType) { return fieldAnnotation.annotationValueInfo(name) .get() .enumValue(enumType); }
public List<AnnotationValueInfo> annotationValueInfoList() { return annotationValueInfoMap().list(); }
private Stream<PackageAnnotationArtifactGenerator> generatorStream(AnnotationInfo annotationInfo) { return annotationInfo.annotationInfoArrayValue("value") .map(List::stream) .orElse(Stream.of()) .map(this::generatorSupplier); }
@AutoFunctional public boolean hasAnnotation(Class<? extends Annotation> type) { Optional<AnnotationInfo> maybeAnnotation = annotationInfoMap().get(type); return maybeAnnotation.isPresent(); }
SimpleTypeInfo fieldAnnotationSimpleTypeInfoValue(String name) { return fieldAnnotation.annotationValueInfo(name) .get() .simpleTypeInfoValue(); }
public Optional<List<EnumConstantInfo>> getEnumArray(String name) { return annotationValueInfoMap().getEnumArray(name); }
private static Optional<InvalidateMethod> of1(TypeInfo typeInfo, MethodInfo method, AnnotationInfo annotation) { String annotationName = annotation.simpleName(); if (method.hasModifierInfo(ModifierInfo.FINAL)) { method.compilationError("@%s method cannot be final", annotationName); return Optional.empty(); } if (method.hasAccessInfo(AccessInfo.PRIVATE)) { method.compilationError("@%s method cannot be private", annotationName); return Optional.empty(); } SimpleTypeInfo returnTypeInfo = method.returnTypeInfo(); boolean self = returnTypeInfo.equals(typeInfo.toSimpleTypeInfo()); if (!returnTypeInfo.equals(SimpleTypePrimitives.VOID) && !self) { method.compilationError("@%s method must return void or self", annotationName); return Optional.empty(); } InvalidateMethod invalidateMethod = new InvalidateMethod(method, annotation, self); return Optional.of(invalidateMethod); }
static DecimalFormatMethod whenZero(Property property, AnnotationInfo fieldAnnotation, AnnotationInfo whenZero) { double value = 0d; String text = whenZero.stringValue("value").get(); return new DecimalFormatMethodConditional(property, fieldAnnotation, ComparisonOperator.EQ, value, text); }
String fieldAnnotationStringValue(String name) { return fieldAnnotation.annotationValueInfo(name) .get() .stringValue(); }
public Optional<List<AnnotationInfo>> getAnnotationArray(String name) { return annotationValueInfoMap().getAnnotationArray(name); }
public static FieldMethod code(Property property) { AnnotationInfo fieldAnnotation = property.annotationInfoAnnotatedWith(FieldAnnotation.class).get(); String fieldAnnotationName = fieldAnnotation.simpleName(); switch (fieldAnnotationName) { case "CustomFormat": return CustomFormatMethod.code(property, fieldAnnotation); case "DecimalFormat": return DecimalFormatMethod.code(property, fieldAnnotation); case "Fill": return FillMethod.code(property, fieldAnnotation); case "Fixed": return FixedMethod.code(property, fieldAnnotation); case "FlatEnumFormat": return FlatEnumFormatMethod.code(property, fieldAnnotation); case "IntegerFormat": return IntegerFormatMethod.code(property, fieldAnnotation); case "LocalDateFormat": return LocalDateFormatMethod.code(property, fieldAnnotation); case "Text": return TextMethod.code(property, fieldAnnotation); default: throw new AssertionError(); } }
static IntegerFormatMethod whenZero(Property property, AnnotationInfo fieldAnnotation, AnnotationInfo whenZero) { int value = 0; String text = whenZero.stringValue("value").get(); return new IntegerFormatMethodConditional(property, fieldAnnotation, ComparisonOperator.EQ, value, text); }
int fieldAnnotationIntValue(String name) { return fieldAnnotation.annotationValueInfo(name) .get() .intValue(); }
public Optional<List<SimpleTypeInfo>> getTypeArray(String name) { return annotationValueInfoMap().getTypeArray(name); }
private Artifact generate(Class<?> generator, Iterable<Plugin> pluginList, TypeInfo typeInfo) { PojoArtifactGenerator artifactGenerator = new PojoArtifactGenerator(typeInfo) .generatedBy(generator) .classNamePrefix(annotationInfo.stringValue("classNamePrefix", classNamePrefix())) .addAnnotations(annotations()) .addInterfaces(interfaces()) .skipConstructorValidation(); return configure(artifactGenerator).generateWith(pluginList); }
char fieldAnnotationCharValue(String name) { return fieldAnnotation.annotationValueInfo(name) .get() .charValue(); }