@RequiredArgsConstructor
public class FetchDescendantsOption {
- public static final FetchDescendantsOption DIRECT_CHILDREN_ONLY
- = new FetchDescendantsOption(1, "DirectChildrenOnly");
+ public static final FetchDescendantsOption DIRECT_CHILD_ONLY
+ = new FetchDescendantsOption(1, "DirectChildOnly");
public static final FetchDescendantsOption OMIT_DESCENDANTS
= new FetchDescendantsOption(0, "OmitDescendants");
public static final FetchDescendantsOption INCLUDE_ALL_DESCENDANTS
}
private static final Pattern FETCH_DESCENDANTS_OPTION_PATTERN =
- Pattern.compile("^$|^all$|^none$|^[0-9]+$|^-1$");
+ Pattern.compile("^$|^all$|^none$|^direct$|^[0-9]+$|^-1$|^1$");
private final int depth;
return nextDescendantsOption;
}
+ /**
+ * Get depth.
+ * @return depth: -1 for all descendants, 0 for no descendants, or positive value for fixed level of descendants
+ */
+ public int getDepth() {
+ return depth;
+ }
+
/**
* get fetch descendants option for given descendant.
*
return FetchDescendantsOption.OMIT_DESCENDANTS;
} else if ("-1".equals(fetchDescendantsOptionAsString) || "all".equals(fetchDescendantsOptionAsString)) {
return FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS;
+ } else if ("1".equals(fetchDescendantsOptionAsString) || "direct".equals(fetchDescendantsOptionAsString)) {
+ return FetchDescendantsOption.DIRECT_CHILD_ONLY;
} else {
final Integer depth = Integer.valueOf(fetchDescendantsOptionAsString);
return new FetchDescendantsOption(depth);