1515 */
1616package org .springframework .data .jpa .repository .query ;
1717
18- import java .util .Arrays ;
1918import java .util .List ;
2019
2120import org .springframework .data .jpa .repository .EntityGraph ;
2928 *
3029 * @author Thomas Darimont
3130 * @author Mark Paluch
31+ * @author Christoph Strobl
3232 * @since 1.6
3333 */
3434public class JpaEntityGraph {
3535
36- private static String [] EMPTY_ATTRIBUTE_PATHS = {};
37-
3836 private final String name ;
3937 private final EntityGraphType type ;
4038 private final List <String > attributePaths ;
@@ -46,8 +44,8 @@ public class JpaEntityGraph {
4644 * @param nameFallback must not be {@literal null} or empty.
4745 */
4846 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 ());
5149 }
5250
5351 /**
@@ -65,7 +63,7 @@ public JpaEntityGraph(String name, EntityGraphType type, @Nullable String[] attr
6563
6664 this .name = name ;
6765 this .type = type ;
68- this .attributePaths = Arrays . asList ( attributePaths == null ? EMPTY_ATTRIBUTE_PATHS : attributePaths );
66+ this .attributePaths = attributePaths != null ? List . of ( attributePaths ) : List . of ( );
6967 }
7068
7169 /**
@@ -99,9 +97,11 @@ public List<String> getAttributePaths() {
9997 /**
10098 * Return {@literal true} if this {@link JpaEntityGraph} needs to be generated on-the-fly.
10199 *
102- * @return
100+ * @return {@literal true} if {@link #attributePaths} is not empty.
103101 * @since 1.9
102+ * @deprecated since 3.5 as the used evaluation does not represent wether a {@link JpaEntityGraph} is dynamic or not.
104103 */
104+ @ Deprecated (since = "3.5" , forRemoval = true )
105105 public boolean isAdHocEntityGraph () {
106106 return !attributePaths .isEmpty ();
107107 }
0 commit comments