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(); }
@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()); } }
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(); }