Class ExpressionBuilder

java.lang.Object
org.simpleframework.xml.core.ExpressionBuilder

class ExpressionBuilder extends Object
The ExpressionBuilder object is used build and cache path expressions. The expressions provided by this must be valid XPath expressions. However, only a subset of the full XPath syntax is supported. Because these expressions require parsing they are cached internally. This improves performance as if a path expression is declared several times it is parsed once.
See Also:
  • Field Details

    • cache

      private final Cache<Expression> cache
      This is the cache of path expressions previously built.
    • format

      private final Format format
      This is the format used to style the path segments.
    • type

      private final Class type
      This is the type the expressions are being built for.
  • Constructor Details

    • ExpressionBuilder

      public ExpressionBuilder(Detail detail, Support support)
      Constructor for the ExpressionBuilder. This is used to create a builder to cache frequently requested XPath expressions. Such caching improves the overall performance.
      Parameters:
      detail - the details for the the class with expressions
      support - this contains various support functions
  • Method Details

    • build

      public Expression build(String path) throws Exception
      This is used to create an Expression from the provided path. If the path does not conform to the syntax supported then an exception is thrown to indicate the error. If the path was requested before, a cached instance is used.
      Parameters:
      path - this is the XPath expression to be parsed
      Returns:
      this returns the resulting expression object
      Throws:
      Exception
    • create

      private Expression create(String path) throws Exception
      This is used to create an Expression from the provided path. If the path does not conform to the syntax supported then an exception is thrown to indicate the error.
      Parameters:
      path - this is the XPath expression to be parsed
      Returns:
      this returns the resulting expression object
      Throws:
      Exception