private static String stringValue(TypeInfo typeInfo, Class<? extends Annotation> type) { return typeInfo.annotationInfo(type) .flatMap(annotationInfo -> annotationInfo.stringValue("value")) .get(); }
private String stringValue(Class<? extends Annotation> type) { return typeInfo.annotationInfo(type) .flatMap(ann -> ann.stringValue("value")) .get(); }
private String attributeName() { return methodInfo.annotationInfo(Attribute.class) .flatMap(ann -> ann.stringValue("name")) .orElse(methodInfo.name()); }
private static String classSimpleName(TypeInfo typeInfo) { String simpleName = typeInfo.annotationInfo(ProtoType.class) .flatMap(annotationInfo -> annotationInfo.stringValue("className")) .get(); return "".equals(simpleName) ? Code.upperCaseFirstChar(typeInfo.simpleName()) : simpleName; }
public static BaseTypeType of(TypeInfo typeInfo) { return new BaseTypeType( typeInfo.className(), typeInfo.annotationInfo(BaseType.class) .flatMap(ann -> ann.stringValue("className")) .get(), typeInfo.methodInfoStream() .map(AttributeMethod::of) .collect(Collectors.toList())); }
private ClassName superclassTypeNameRaw() { TypeInfo baseTypeInfo = typeInfo.interfaceTypeInfoAnnotatedWith(BaseType.class).get(); return baseTypeInfo.annotationInfo(BaseType.class) .flatMap(ann -> ann.stringValue("className")) .map(s -> baseTypeInfo.className().peerClass(s)) .get(); }
public static AttributeAnnotation of(AnnotationInfo annotationInfo) { String name = annotationInfo.stringValue("name").get(); String maybeIdentifier = annotationInfo.stringValue("identifier").get(); String identifier = Strings.isNullOrEmpty(maybeIdentifier) ? name : maybeIdentifier; return AttributeAnnotation.builder() .name(name) .identifier(identifier) .typeName(annotationInfo.simpleTypeInfoValue("type").get().typeName()) .build(); }
@Override public CodeBlock onForeignKey(ForeignKeyOrmProperty property) { String columnName = property.columnAnnotationClassList().get(0) .typeInfo() .flatMap(t -> t.annotationInfo(ColumnName.class)) .flatMap(ann -> ann.stringValue("value")) .get(); return CodeBlock.builder() .add(",\n $L(rs, $S)", name(property), columnName) .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(); }
.columnSimpleName(columnAnnotationInfo .annotationInfo(ColumnName.class) .flatMap(ann -> ann.stringValue("value")) .get()) .bindType(returnTypeHelper.bindType(columnClassTypeInfo))