TypeInfo toPojoTypeInfo(SimpleTypeInfo returnTypeInfo) { return returnTypeInfo.typeInfo().get(); }
public boolean isEnum() { boolean isEnum = false; Optional<TypeInfo> maybeTypeInfo = typeInfo(); if (maybeTypeInfo.isPresent()) { isEnum = maybeTypeInfo.get().isEnum(); } return isEnum; }
@Override public boolean test(Property property) { return property.returnTypeInfo() .typeInfo() .map(typeInfo -> typeInfo.hasAnnotation(type)) .orElse(Boolean.FALSE) .booleanValue(); }
@Override public boolean test(Property property) { return property.returnTypeInfo() .typeInfo() .map(typeInfo -> typeInfo.hasAnnotation(type)) .orElse(Boolean.FALSE) .booleanValue(); }
public static Optional<OrmPojoInfo> of(SimpleTypeInfo returnTypeInfo) { TypeInfo typeInfo = returnTypeInfo.isInfoOf(Optional.class) ? returnTypeInfo.getTypeParameterInfoStream() .findFirst() .flatMap(TypeParameterInfo::typeInfo) .get() : returnTypeInfo.typeInfo().get(); PojoInfo pojoInfo = PojoInfo.of(typeInfo); return of(pojoInfo); }
private static BindType ofEnum(SimpleTypeInfo returnTypeInfo, TypeInfo columnClassTypeInfo) { EnumType enumType = columnClassTypeInfo.annotationInfo(EnumColumn.class) .flatMap(ann -> ann.enumConstantInfoValue("value")) .map(info -> info.getEnumValue(EnumType.class)) .orElse(EnumType.VOID); switch (enumType) { default: case ORDINAL: return ENUM_ORDINAL; case STRING: return returnTypeInfo.typeInfo().get().getInterface(EnumSql.class).isPresent() ? ENUM_SQL : ENUM_STRING; } }
@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(); }
public static ForeignKeyOrmProperty of(Property property, AnnotationInfo foreignKeyAnnotationInfo) { List<SimpleTypeInfo> columnAnnotationClassList = foreignKeyAnnotationInfo .annotationInfo(ColumnAnnotationClassArray.class) .flatMap(ann -> ann.simpleTypeInfoArrayValue("value")) .get(); return ForeignKeyOrmProperty.builder() .property(property) .returnType(ReturnTypeHelper.of(property.returnTypeInfo()).returnType()) .tableInfo(TableInfoAnnotationInfo.of(foreignKeyAnnotationInfo)) .columnAnnotationClassList(columnAnnotationClassList) .columnSeq(columnAnnotationClassList.get(0) .typeInfo() .flatMap(t -> t.annotationInfo(ColumnSeq.class)) .flatMap(ann -> ann.annotationValueInfo("value")) .get() .intValue()) .foreignKeyAnnotationInfo(foreignKeyAnnotationInfo) .build(); }
.annotationInfo(ColumnClass.class) .flatMap(annotationInfo -> annotationInfo.simpleTypeInfoValue("value")) .flatMap(typeInfo -> typeInfo.typeInfo()) .get();