15
15
*/
16
16
package org .springframework .data .jpa .repository .query ;
17
17
18
- import java .util .Arrays ;
19
18
import java .util .List ;
20
19
21
20
import org .springframework .data .jpa .repository .EntityGraph ;
29
28
*
30
29
* @author Thomas Darimont
31
30
* @author Mark Paluch
31
+ * @author Christoph Strobl
32
32
* @since 1.6
33
33
*/
34
34
public class JpaEntityGraph {
35
35
36
- private static String [] EMPTY_ATTRIBUTE_PATHS = {};
37
-
38
36
private final String name ;
39
37
private final EntityGraphType type ;
40
38
private final List <String > attributePaths ;
@@ -46,8 +44,8 @@ public class JpaEntityGraph {
46
44
* @param nameFallback must not be {@literal null} or empty.
47
45
*/
48
46
public JpaEntityGraph (EntityGraph entityGraph , String nameFallback ) {
49
- this (StringUtils .hasText (entityGraph .value ()) ? entityGraph .value () : nameFallback , entityGraph .type (), entityGraph
50
- .attributePaths ());
47
+ this (StringUtils .hasText (entityGraph .value ()) ? entityGraph .value () : nameFallback , entityGraph .type (),
48
+ entityGraph .attributePaths ());
51
49
}
52
50
53
51
/**
@@ -65,7 +63,7 @@ public JpaEntityGraph(String name, EntityGraphType type, @Nullable String[] attr
65
63
66
64
this .name = name ;
67
65
this .type = type ;
68
- this .attributePaths = Arrays . asList ( attributePaths == null ? EMPTY_ATTRIBUTE_PATHS : attributePaths );
66
+ this .attributePaths = attributePaths != null ? List . of ( attributePaths ) : List . of ( );
69
67
}
70
68
71
69
/**
@@ -99,9 +97,11 @@ public List<String> getAttributePaths() {
99
97
/**
100
98
* Return {@literal true} if this {@link JpaEntityGraph} needs to be generated on-the-fly.
101
99
*
102
- * @return
100
+ * @return {@literal true} if {@link #attributePaths} is not empty.
103
101
* @since 1.9
102
+ * @deprecated since 3.5 as the used evaluation does not represent whether a {@link JpaEntityGraph} is dynamic or not.
104
103
*/
104
+ @ Deprecated (since = "3.5" , forRemoval = true )
105
105
public boolean isAdHocEntityGraph () {
106
106
return !attributePaths .isEmpty ();
107
107
}
0 commit comments