private List<Property> propertyList() { return pojoInfo.propertyStream().collect(Collectors.toList()); }
@Override public boolean test(PojoInfo pojoInfo) { return pojoInfo.instanceOf(type); }
public static PojoInfo of(TypeInfo typeInfo) { return of(Mode.STANDARD, typeInfo); }
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(); }
Naming naming() { return pojoInfo().naming(); }
@Override public Contribution execute(PojoInfo pojoInfo) { return pojoInfo.methodInfoStream() .filter(m -> m.hasName("isEqualTo")) .filter(m -> m.hasParameterInfoListSize(1)) .filter(m -> m.hasModifierInfo(ModifierInfo.ABSTRACT)) .findFirst() .map(m -> execute0(pojoInfo)) .orElse(Contribution.empty()); }
public static OrmInject of(PojoInfo pojoInfo) { return ofStream(pojoInfo.ignoredPropertyStream()) .orElse(ofStream(pojoInfo.propertyStream()) .orElse(ofConstructor(pojoInfo) .orElse(StandardOrmInject.INSTANCE))); }
private static PojoInfo of0(Mode mode, TypeInfo typeInfo) { return new PojoInfo( mode, typeInfo, Naming.of(typeInfo)); }
@Override public boolean test(PojoInfo pojoInfo) { return pojoInfo.hasName(name); }
@Override public boolean test(PojoInfo pojoInfo) { return pojoInfo.hasInterface(type); }
@Override public boolean test(PojoInfo pojoInfo) { return pojoInfo.hasAnnotation(type); }
public void addPropertyCondition(PropertyPredicate condition) { pojoInfo.addPropertyCondition(condition); }
public static TestableContribution of(PojoInfo pojoInfo) { Naming naming = pojoInfo.naming(); TypeName superClassTypeName = naming.superClassTypeName(); ParameterizedTypeName testerTypeName = ParameterizedTypeName.get(TESTER, naming.superClass()); return superClassTypeName instanceof ParameterizedTypeName ? new Generic(pojoInfo, testerTypeName) : new TestableContribution(pojoInfo, testerTypeName); }
private void executeMethodPluginList() { pojoInfo.methodInfoStream().forEach(method -> { for (MethodPlugin plugin : methodPluginList) { if (plugin.test(method)) { plugin.accept(generatedBy); Contribution contribution = plugin.execute(pojoInfo, method); contribution.accept(type); invalidateMethodList.forEach(m -> contribution.acceptInvalidateMethod(m)); } } }); }
private static PojoInfo of0(Mode mode, TypeInfo typeInfo) { return new PojoInfo( mode, typeInfo, Naming.of(typeInfo)); }
@Override public boolean test(PojoInfo pojoInfo) { return pojoInfo.hasName(name); }
@Override public boolean test(PojoInfo pojoInfo) { return pojoInfo.hasInterface(type); }
@Override public boolean test(PojoInfo pojoInfo) { return pojoInfo.hasAnnotation(type); }
public void addPropertyCondition(PropertyPredicate condition) { pojoInfo.addPropertyCondition(condition); }
public static PojoClass of(PojoInfo pojoInfo, TypeInfo typeInfo) { Naming naming = pojoInfo.naming(); TypeSpec.Builder type = TypeSpec .classBuilder(naming.pojoSimpleName()) .addModifiers(Modifier.FINAL) .superclass(naming.superClassTypeName()); naming.typeVariableNameListTo(type); List<InvalidateMethod> invalidateMethodList = InvalidateMethod.of(typeInfo); return new PojoClass(pojoInfo, type, invalidateMethodList); }