Skip to content

Commit ccd8eaf

Browse files
committed
Base-query finished
1 parent 9482233 commit ccd8eaf

File tree

7 files changed

+730
-731
lines changed

7 files changed

+730
-731
lines changed

project/jimmer-apt/src/main/java/org/babyfish/jimmer/apt/JimmerProcessor.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import org.babyfish.jimmer.apt.error.ErrorProcessor;
99
import org.babyfish.jimmer.apt.immutable.ImmutableProcessor;
1010
import org.babyfish.jimmer.apt.transactional.TxProcessor;
11-
import org.babyfish.jimmer.apt.tuple.TypedTupleProcessor;
11+
// TUPLE: import org.babyfish.jimmer.apt.tuple.TypedTupleProcessor;
1212
import org.babyfish.jimmer.client.EnableImplicitApi;
1313
import org.babyfish.jimmer.client.FetchBy;
1414
import org.babyfish.jimmer.dto.compiler.DtoAstException;
1515
import org.babyfish.jimmer.dto.compiler.DtoModifier;
1616
import org.babyfish.jimmer.dto.compiler.DtoUtils;
17-
import org.babyfish.jimmer.sql.TypedTuple;
17+
// TUPLE: import org.babyfish.jimmer.sql.TypedTuple;
1818
import org.babyfish.jimmer.sql.EnableDtoGeneration;
1919

2020
import javax.annotation.processing.*;
@@ -198,12 +198,12 @@ public boolean process(
198198
new TxProcessor(context).process(roundEnv);
199199
new ExportDocProcessor(context).process(roundEnv);
200200
if (!immutableTypeElements.isEmpty() || errorGenerated || dtoGenerated) {
201-
delayedTupleTypeNames = roundEnv
202-
.getElementsAnnotatedWith(TypedTuple.class)
203-
.stream()
204-
.filter(it -> it instanceof TypeElement)
205-
.map(it -> ((TypeElement) it).getQualifiedName().toString())
206-
.collect(Collectors.toSet());
201+
// delayedTupleTypeNames = roundEnv
202+
// .getElementsAnnotatedWith(TypedTuple.class)
203+
// .stream()
204+
// .filter(it -> it instanceof TypeElement)
205+
// .map(it -> ((TypeElement) it).getQualifiedName().toString())
206+
// .collect(Collectors.toSet());
207207
delayedClientTypeNames = roundEnv
208208
.getRootElements()
209209
.stream()
@@ -215,7 +215,7 @@ public boolean process(
215215
}
216216
if (!toolGenerated && !context.isBuddyIgnoreResourceGeneration()) {
217217
toolGenerated = true;
218-
new TypedTupleProcessor(context, delayedTupleTypeNames).process(roundEnv);
218+
//new TypedTupleProcessor(context, delayedTupleTypeNames).process(roundEnv);
219219
new ClientProcessor(context, clientExplicitApi, delayedClientTypeNames).process(roundEnv);
220220
delayedClientTypeNames = null;
221221
}

project/jimmer-apt/src/main/java/org/babyfish/jimmer/apt/immutable/generator/TableGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.babyfish.jimmer.apt.immutable.generator;
22

33
import com.squareup.javapoet.*;
4-
import jdk.internal.classfile.CodeBuilder;
54
import org.babyfish.jimmer.apt.GeneratorException;
65
import org.babyfish.jimmer.apt.Context;
76
import org.babyfish.jimmer.apt.immutable.meta.ImmutableProp;
Lines changed: 109 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,109 @@
1-
package org.babyfish.jimmer.apt.tuple;
2-
3-
import com.squareup.javapoet.ClassName;
4-
import com.squareup.javapoet.ParameterizedTypeName;
5-
import com.squareup.javapoet.TypeName;
6-
import com.squareup.javapoet.TypeSpec;
7-
import org.babyfish.jimmer.apt.Context;
8-
import org.babyfish.jimmer.apt.MetaException;
9-
import org.babyfish.jimmer.apt.immutable.generator.Constants;
10-
import org.babyfish.jimmer.sql.TypedTuple;
11-
12-
import javax.lang.model.element.*;
13-
import javax.lang.model.type.PrimitiveType;
14-
import javax.lang.model.type.TypeMirror;
15-
import java.util.ArrayList;
16-
import java.util.Collections;
17-
import java.util.List;
18-
19-
public abstract class AbstractMemberGenerator {
20-
21-
protected final Context context;
22-
23-
protected final TypeElement typeElement;
24-
25-
protected final ClassName className;
26-
27-
protected final TypeSpec.Builder typeBuilder;
28-
29-
protected final List<VariableElement> fieldElements;
30-
31-
AbstractMemberGenerator(
32-
Context context,
33-
TypeElement typeElement,
34-
ClassName className,
35-
TypeSpec.Builder typeBuilder
36-
) {
37-
this.context = context;
38-
this.typeElement = typeElement;
39-
this.className = className;
40-
this.typeBuilder = typeBuilder;
41-
List<VariableElement> fieldElements = new ArrayList<>();
42-
for (Element element : typeElement.getEnclosedElements()) {
43-
if (element instanceof VariableElement) {
44-
if (!element.getModifiers().contains(Modifier.STATIC)) {
45-
validateFieldElement((VariableElement) element);
46-
fieldElements.add((VariableElement) element);
47-
}
48-
}
49-
}
50-
if (fieldElements.isEmpty()) {
51-
throw new MetaException(
52-
typeElement,
53-
"There is no non-state field"
54-
);
55-
}
56-
this.fieldElements = Collections.unmodifiableList(fieldElements);
57-
}
58-
59-
private void validateFieldElement(VariableElement fieldElement) {
60-
if (context.isDto(fieldElement.asType())) {
61-
throw new MetaException(
62-
fieldElement,
63-
"The field of type decorated by \"@" +
64-
TypedTuple.class.getName() +
65-
"\" cannot be dto"
66-
);
67-
}
68-
}
69-
70-
protected final TypeName expressionTypeName(VariableElement fieldElement, boolean typeBootstrap) {
71-
TypeMirror type = fieldElement.asType();
72-
if (context.isEntity(type)) {
73-
return context.getImmutableType(type).getTableClassName();
74-
}
75-
if (typeBootstrap) {
76-
if (context.isEmbeddable(type)) {
77-
return context.getImmutableType(type).getPropExpressionClassName();
78-
}
79-
if (context.isDate(type)) {
80-
return ParameterizedTypeName.get(
81-
Constants.DATE_EXPRESSION_CLASS_NAME,
82-
ClassName.get(type).box()
83-
);
84-
}
85-
if (context.isTemporal(type)) {
86-
return ParameterizedTypeName.get(
87-
Constants.TEMPORAL_EXPRESSION_CLASS_NAME,
88-
ClassName.get(type).box()
89-
);
90-
}
91-
if (context.isNumber(type) || type instanceof PrimitiveType) {
92-
return ParameterizedTypeName.get(
93-
Constants.NUMERIC_EXPRESSION_CLASS_NAME,
94-
ClassName.get(type).box()
95-
);
96-
}
97-
if (context.isComparable(type)) {
98-
return ParameterizedTypeName.get(
99-
Constants.COMPARABLE_EXPRESSION_CLASS_NAME,
100-
ClassName.get(type).box()
101-
);
102-
}
103-
}
104-
return ParameterizedTypeName.get(
105-
Constants.EXPRESSION_CLASS_NAME,
106-
ClassName.get(type).box()
107-
);
108-
}
109-
}
1+
//package org.babyfish.jimmer.apt.tuple;
2+
//
3+
//import com.squareup.javapoet.ClassName;
4+
//import com.squareup.javapoet.ParameterizedTypeName;
5+
//import com.squareup.javapoet.TypeName;
6+
//import com.squareup.javapoet.TypeSpec;
7+
//import org.babyfish.jimmer.apt.Context;
8+
//import org.babyfish.jimmer.apt.MetaException;
9+
//import org.babyfish.jimmer.apt.immutable.generator.Constants;
10+
//import org.babyfish.jimmer.sql.TypedTuple;
11+
//
12+
//import javax.lang.model.element.*;
13+
//import javax.lang.model.type.PrimitiveType;
14+
//import javax.lang.model.type.TypeMirror;
15+
//import java.util.ArrayList;
16+
//import java.util.Collections;
17+
//import java.util.List;
18+
//
19+
//public abstract class AbstractMemberGenerator {
20+
//
21+
// protected final Context context;
22+
//
23+
// protected final TypeElement typeElement;
24+
//
25+
// protected final ClassName className;
26+
//
27+
// protected final TypeSpec.Builder typeBuilder;
28+
//
29+
// protected final List<VariableElement> fieldElements;
30+
//
31+
// AbstractMemberGenerator(
32+
// Context context,
33+
// TypeElement typeElement,
34+
// ClassName className,
35+
// TypeSpec.Builder typeBuilder
36+
// ) {
37+
// this.context = context;
38+
// this.typeElement = typeElement;
39+
// this.className = className;
40+
// this.typeBuilder = typeBuilder;
41+
// List<VariableElement> fieldElements = new ArrayList<>();
42+
// for (Element element : typeElement.getEnclosedElements()) {
43+
// if (element instanceof VariableElement) {
44+
// if (!element.getModifiers().contains(Modifier.STATIC)) {
45+
// validateFieldElement((VariableElement) element);
46+
// fieldElements.add((VariableElement) element);
47+
// }
48+
// }
49+
// }
50+
// if (fieldElements.isEmpty()) {
51+
// throw new MetaException(
52+
// typeElement,
53+
// "There is no non-state field"
54+
// );
55+
// }
56+
// this.fieldElements = Collections.unmodifiableList(fieldElements);
57+
// }
58+
//
59+
// private void validateFieldElement(VariableElement fieldElement) {
60+
// if (context.isDto(fieldElement.asType())) {
61+
// throw new MetaException(
62+
// fieldElement,
63+
// "The field of type decorated by \"@" +
64+
// TypedTuple.class.getName() +
65+
// "\" cannot be dto"
66+
// );
67+
// }
68+
// }
69+
//
70+
// protected final TypeName expressionTypeName(VariableElement fieldElement, boolean typeBootstrap) {
71+
// TypeMirror type = fieldElement.asType();
72+
// if (context.isEntity(type)) {
73+
// return context.getImmutableType(type).getTableClassName();
74+
// }
75+
// if (typeBootstrap) {
76+
// if (context.isEmbeddable(type)) {
77+
// return context.getImmutableType(type).getPropExpressionClassName();
78+
// }
79+
// if (context.isDate(type)) {
80+
// return ParameterizedTypeName.get(
81+
// Constants.DATE_EXPRESSION_CLASS_NAME,
82+
// ClassName.get(type).box()
83+
// );
84+
// }
85+
// if (context.isTemporal(type)) {
86+
// return ParameterizedTypeName.get(
87+
// Constants.TEMPORAL_EXPRESSION_CLASS_NAME,
88+
// ClassName.get(type).box()
89+
// );
90+
// }
91+
// if (context.isNumber(type) || type instanceof PrimitiveType) {
92+
// return ParameterizedTypeName.get(
93+
// Constants.NUMERIC_EXPRESSION_CLASS_NAME,
94+
// ClassName.get(type).box()
95+
// );
96+
// }
97+
// if (context.isComparable(type)) {
98+
// return ParameterizedTypeName.get(
99+
// Constants.COMPARABLE_EXPRESSION_CLASS_NAME,
100+
// ClassName.get(type).box()
101+
// );
102+
// }
103+
// }
104+
// return ParameterizedTypeName.get(
105+
// Constants.EXPRESSION_CLASS_NAME,
106+
// ClassName.get(type).box()
107+
// );
108+
// }
109+
//}

0 commit comments

Comments
 (0)