|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.avaje.ebean.text.PathProperties
public class PathProperties
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 | |
---|---|
static class |
PathProperties.Props
|
Constructor Summary | |
---|---|
PathProperties()
Construct an empty PathProperties. |
Method Summary | |
---|---|
void |
addToPath(String path,
String property)
|
void |
apply(Query<?> query)
Apply these path properties as fetch paths to the query. |
PathProperties |
copy()
Create a copy of this instance so that it can be modified. |
Set<String> |
get(String path)
Get the properties for a given path. |
Collection<PathProperties.Props> |
getPathProps()
|
Set<String> |
getPaths()
Return a shallow copy of the paths. |
boolean |
hasPath(String path)
Return true if the path is defined and has properties. |
boolean |
isEmpty()
Return true if there are no paths defined. |
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". |
void |
put(String path,
Set<String> properties)
Set the properties for a given path. |
Set<String> |
remove(String path)
Remove a path returning the properties set for that path. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PathProperties()
Method Detail |
---|
public static PathProperties parse(String source)
public PathProperties copy()
For example, you may want to create a copy to add extra properties to a path so that they are fetching in a ORM query but perhaps not rendered by default. That is, use a PathProperties for JSON or XML rendering, but create a copy, add some extra properties and then use that copy to define an ORM query.
public boolean isEmpty()
public String toString()
toString
in class Object
public boolean hasPath(String path)
public Set<String> get(String path)
public void addToPath(String path, String property)
public void put(String path, Set<String> properties)
public Set<String> remove(String path)
public Set<String> getPaths()
public Collection<PathProperties.Props> getPathProps()
public void apply(Query<?> query)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |