Beispiel #1
0
 public static TableClassInfo of(AnnotationInfo columnAnnotationInfo) {
   Preconditions.checkArgument(
       columnAnnotationInfo.hasAnnotation(ColumnAnnotation.class)
           || columnAnnotationInfo.hasAnnotation(ForeignKeyAnnotation.class));
   TypeInfo tableTypeInfo = columnAnnotationInfo.enclosingTypeInfo().get();
   return qualifiedNameMap.computeIfAbsent(
       tableTypeInfo.qualifiedName(),
       qname -> {
         return TableClassInfo.builder()
             .tableName(TableNameAnnotationInfo.of(tableTypeInfo))
             .tableClassName(
                 columnAnnotationInfo
                     .enclosingSimpleTypeInfo()
                     .map(SimpleTypeInfo::className)
                     .get())
             .columnAnnotationClassList(
                 tableTypeInfo
                     .annotationInfo(ColumnAnnotationClassArray.class)
                     .flatMap(ann -> ann.simpleTypeInfoArrayValue("value"))
                     .get())
             .insertClassName(
                 tableTypeInfo
                     .annotationInfo(InsertClass.class)
                     .flatMap(ann -> ann.simpleTypeInfoValue("value"))
                     .map(SimpleTypeInfo::className)
                     .get())
             .primaryKeyList(
                 tableTypeInfo
                     .annotationInfo(PrimaryKeyClassArray.class)
                     .flatMap(ann -> ann.simpleTypeInfoArrayValue("value"))
                     .orElse(ImmutableList.of()))
             .build();
       });
 }
Beispiel #2
0
 private SqlInsertable sqlInsertable(TypeInfo typeInfo, List<SqlPojoMethod> methodList) {
   return typeInfo.hasInterface("br.com.objectos.way.relational.Insertable")
       ? LegacySqlInsertable.legacyBuilder()
           .tableClassName(tableClassName())
           .insertClassName(insertClassName())
           .methodList(methodList)
           .tableName(tableName())
           .build()
       : SqlInsertable.builder()
           .tableClassName(tableClassName())
           .insertClassName(insertClassName())
           .methodList(methodList)
           .build();
 }