@Override public PojoPropertyFieldBuilder name() { name = property.name(); return this; }
@Override public boolean test(Property property) { return property.hasAnnotation(type); }
public PojoProperty standardPojoProperty() { return PojoProperty.of(standardPojoField(), standardPojoConstructorStatement(), standardPojoMethod()); }
public static OrmInject of(Property property) { return new PropertyOrmInject( property, property.returnTypeInfo().typeName(), property.name()); }
private CodeBlock fieldInitializer() { Naming naming = pojoInfo.naming(); CodeBlock.Builder init = CodeBlock.builder() .add("$T.of($T.class)\n", TESTER, naming.superClass()); pojoInfo.propertyStream() .filter(property -> !property.hasAnnotation(NotTestable.class)) .forEach(property -> init.add(" .add($S, o -> o.$L())\n", property.name(), property.accessorName())); return init .add(" .build()") .build(); }
private BuilderProperty of(Property property) { return BuilderProperty.methodBuilder(property) .nameSuffix("Of") .addParameter(property.typeParameterInfoStream() .map(TypeParameterInfo::typeNameBound) .findFirst() .get()) .assignment("$T.of($L)", Optional.class, property.name()) .build(); }
public ReturnTypeAdapterPojo(ForeignKeyOrmProperty property) { fieldName = property.property().name(); columnName = property.columnAnnotationClassList().get(0) .typeInfo() .flatMap(t -> t.annotationInfo(ColumnName.class)) .flatMap(ann -> ann.stringValue("value")) .get(); ColumnOrmProperty refMethod = property.referencedPropertyList().get(0); propertyAccessor = refMethod.property().accessorName(); bindTypeAccessor = refMethod.bindType().accessor(); }
private static Optional<OrmInject> ofStream(Stream<Property> propertyStream) { return propertyStream .filter(property -> { SimpleTypeInfo returnTypeInfo = property.returnTypeInfo(); return returnTypeInfo.isSubType(Orm.class); }) .map(PropertyOrmInject::of) .findFirst(); }
private MethodInfo methodInfo() { return property.methodInfo(); }
@Override void acceptBuilderClass(TypeSpec.Builder type) { Naming naming = property.naming(); MethodInfo methodInfo = property.methodInfo(); type.addSuperinterface(naming.builderInnerTypeName(methodInfo)); }
@Override public Contribution execute() { return Contribution.builder() .addCustomField(typeName, name) .addPojoProperty(property.standardPojoMethod()) .build(); }
private static List<Property> of0(Mode mode, TypeInfo typeInfo) { Naming naming = Naming.of(typeInfo); return typeInfo.methodInfoStream() .filter(m -> m.hasModifierInfo(ModifierInfo.ABSTRACT)) .filter(m -> !m.hasReturnTypeInfo(SimpleTypePrimitives.VOID)) .filter(m -> m.hasParameterInfoListSize(0)) .filter(m -> !m.hasAnnotation(Invalidate.class)) .map(m -> new Property(mode, naming, m)) .collect(MoreCollectors.toImmutableList()); }
@Override public void onStart(Set<? extends TypeElement> typeElements, RoundEnvironment roundEnv) { PojoInfo.invalidate(); Naming.invalidate(); Property.invalidate(); for (Plugin plugin : pluginList) { plugin.onStart(); } }
@Override public boolean test(Property property) { return property.hasName(name); }
@Override public boolean test(Property property) { return property.instanceOf(type); }
@Override public void acceptColumnsConstructor(ColumnsConstructor constructor) { constructor.set(property().returnTypeInfo().typeName(), property().name()); }
private BuilderProperty of(Property property) { return BuilderProperty.methodBuilder(property) .nameSuffix("Of") .addParameter(property.typeParameterInfoStream() .map(TypeParameterInfo::typeNameBound) .findFirst() .get()) .assignment("$T.of($L)", Optional.class, property.name()) .build(); }
@Override public void acceptIsOrmInsertableHelper(IsOrmInsertableHelper helper) { super.acceptIsOrmInsertableHelper(helper); Iterator<SimpleTypeInfo> columnAnnotationClassIterator = columnAnnotationClassList().iterator(); Iterator<ColumnOrmProperty> referencedPropertyIterator = referencedPropertyList().iterator(); while (columnAnnotationClassIterator.hasNext()) { SimpleTypeInfo columnAnnotationClass = columnAnnotationClassIterator.next(); ColumnOrmProperty referencedProperty = referencedPropertyIterator.next(); helper.addExpressionPart("$T.get().$L($L.$L())", tableInfo().className(), columnAnnotationClass.simpleName(), property().name(), referencedProperty.property().accessorName()); } }