Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4dca91e

Browse files
[generator] Add methods returning empty graphs
1 parent 1e61cb9 commit 4dca91e

File tree

1 file changed

+20
-0
lines changed
  • generator/src/main/java/com/cosium/spring/data/jpa/graph/generator

1 file changed

+20
-0
lines changed

‎generator/src/main/java/com/cosium/spring/data/jpa/graph/generator/EntityGraph.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,24 @@ public EntityGraph(
5757
.addStatement("this.delegate = delegate")
5858
.build();
5959

60+
MethodSpec emptyStaticMethod =
61+
MethodSpec.methodBuilder("empty")
62+
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
63+
.returns(entityGraphClassName)
64+
.addStatement("return $N().$N()", Constants.PATH_SEPARATOR, Constants.PATH_SEPARATOR)
65+
.build();
66+
67+
MethodSpec emptyStaticMethodWithEntityGraphType =
68+
MethodSpec.methodBuilder("empty")
69+
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
70+
.addParameter(Constants.ENTITY_GRAPH_TYPE_CLASS_NAME, "entityGraphType")
71+
.returns(entityGraphClassName)
72+
.addStatement(
73+
"return $N(entityGraphType).$N()",
74+
Constants.PATH_SEPARATOR,
75+
Constants.PATH_SEPARATOR)
76+
.build();
77+
6078
MethodSpec rootStaticMethod =
6179
MethodSpec.methodBuilder(Constants.PATH_SEPARATOR)
6280
.addModifiers(Modifier.PUBLIC, Modifier.STATIC)
@@ -95,6 +113,8 @@ public EntityGraph(
95113
.addField(delegateField)
96114
.addMethod(emptyConstructor)
97115
.addMethod(constructor)
116+
.addMethod(emptyStaticMethod)
117+
.addMethod(emptyStaticMethodWithEntityGraphType)
98118
.addMethod(rootStaticMethod)
99119
.addMethod(rootStaticMethodWithEntityGraphType)
100120
.addMethod(getEntityGraphTypeMethod)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /