Module io.ebean.api
Package io.ebean.text

Class 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).

    • 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".
      • hasPath

        public boolean hasPath​(String path)
        Return true if the path is defined and has properties.
        Specified by:
        hasPath in interface FetchPath
      • addToPath

        public void addToPath​(String path,
                              String property)
      • apply

        public <T> void apply​(Query<T> query)
        Apply these path properties as fetch paths to the query.
        Specified by:
        apply in interface FetchPath
      • 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.