You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by hw...@apache.org on 2015/12/30 12:18:27 UTC
[2/2] deltaspike git commit: DELTASPIKE-1052 Javadoc
DELTASPIKE-1052 Javadoc
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/5555507f
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/5555507f
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/5555507f
Branch: refs/heads/master
Commit: 5555507fe62f783e842fb8a35a5f70db3f5f977a
Parents: a7573a7
Author: Harald Wellmann <hw...@apache.org>
Authored: Wed Dec 30 12:18:16 2015 +0100
Committer: Harald Wellmann <hw...@apache.org>
Committed: Wed Dec 30 12:18:16 2015 +0100
----------------------------------------------------------------------
.../apache/deltaspike/data/api/EntityGraph.java | 31 ++++++++++++++++++--
.../deltaspike/data/api/EntityGraphType.java | 11 +++++++
2 files changed, 40 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/5555507f/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraph.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraph.java b/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraph.java
index ec55532..53b157f 100644
--- a/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraph.java
+++ b/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraph.java
@@ -23,13 +23,40 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * Defines an entity graph to be applied to a query. This annotation can be added to any query
+ * method of a repository class.
+ * <p>
+ * The arguments {@code value} and {@code paths} are mutually exclusive. If {@value is set}, it
+ * references a named entity graph defined by JPA metadata.
+ * <p>
+ * If {@code paths} is set, an entity graph is constructed programmatically from the list of
+ * attribute paths.
+ *
+ */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface EntityGraph
{
+ /**
+ * Name of a named entity graph.
+ * @return graph name
+ */
String value() default "";
-
+
+ /**
+ * Type of entity graph (fetch or load).
+ * @return graph type
+ */
EntityGraphType type() default EntityGraphType.FETCH;
-
+
+ /**
+ * List of attribute paths. Each path may have multiple components, separated
+ * by dots. A single component path adds an attribute node to the entity graph.
+ * A path {@code foo.bar.baz} adds an attribute node {@code baz} to a subgraph
+ * {@code bar} for the subgraph {@code foo}.
+ *
+ * @return list of paths
+ */
String[] paths() default { };
}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/5555507f/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraphType.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraphType.java b/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraphType.java
index 2f5364c..9385a51 100644
--- a/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraphType.java
+++ b/deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/EntityGraphType.java
@@ -18,9 +18,16 @@
*/
package org.apache.deltaspike.data.api;
+/**
+ * Entity graph type (fetch graph or load graph). The type determines
+ * the query hint name used to pass the entity graph to a query.
+ */
public enum EntityGraphType
{
+ /** Fetch graph. */
FETCH("javax.persistence.fetchgraph"),
+
+ /** Load graph. */
LOAD("javax.persistence.loadgraph");
private String hintName;
@@ -30,6 +37,10 @@ public enum EntityGraphType
this.hintName = hintName;
}
+ /**
+ * Gets the query hint name corresponding to this type.
+ * @return hint name
+ */
public String getHintName()
{
return hintName;