Package io.ebean.text
Class PathProperties
- java.lang.Object
-
- io.ebean.text.PathProperties
-
- All Implemented Interfaces:
FetchPath
public class PathProperties extends Object implements FetchPath
This is a Tree like structure of paths and properties that can be used for defining which parts of an object graph to render in JSON or XML, and can also be used to define which parts to select and fetch for an ORM query.It provides a way of parsing a string representation of nested path properties and applying that to both what to fetch (ORM query) and what to render (JAX-RS JSON / XML).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PathProperties.Props
-
Constructor Summary
Constructors Constructor Description PathProperties()
Construct an empty PathProperties.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNested(String prefix, PathProperties pathProps)
void
addToPath(String path, String property)
<T> void
apply(Query<T> query)
Apply these path properties as fetch paths to the query.Collection<PathProperties.Props>
getPathProps()
Set<String>
getProperties(String path)
Get the properties for a given path.boolean
hasPath(String path)
Return true if the path is defined and has properties.boolean
includesPath(String path)
Return true if the fetch path is included in the PathProperties.boolean
includesPath(String prefix, String name)
Return true if the path is included using a prefix.boolean
includesProperty(String name)
Return true if the property (dot notation) is included in the PathProperties.boolean
includesProperty(String prefix, String name)
Return true if the property is included using a prefix.static PathProperties
parse(String source)
Parse and return a PathProperties from nested string format like (a,b,c(d,e),f(g)) where "c" is a path containing "d" and "e" and "f" is a path containing "g" and the root path contains "a","b","c" and "f".String
toString()
-
-
-
Constructor Detail
-
PathProperties
public PathProperties()
Construct an empty PathProperties.
-
-
Method Detail
-
parse
public static PathProperties parse(String source)
Parse and return a PathProperties from nested string format like (a,b,c(d,e),f(g)) where "c" is a path containing "d" and "e" and "f" is a path containing "g" and the root path contains "a","b","c" and "f".
-
getProperties
public Set<String> getProperties(String path)
Get the properties for a given path.- Specified by:
getProperties
in interfaceFetchPath
-
addNested
public void addNested(String prefix, PathProperties pathProps)
-
getPathProps
public Collection<PathProperties.Props> getPathProps()
-
apply
public <T> void apply(Query<T> query)
Apply these path properties as fetch paths to the query.
-
includesProperty
public boolean includesProperty(String name)
Return true if the property (dot notation) is included in the PathProperties.
-
includesProperty
public boolean includesProperty(String prefix, String name)
Return true if the property is included using a prefix.
-
includesPath
public boolean includesPath(String path)
Return true if the fetch path is included in the PathProperties.The fetch path is a OneToMany or ManyToMany path in dot notation.
-
includesPath
public boolean includesPath(String prefix, String name)
Return true if the path is included using a prefix.
-
-