Package org.simpleframework.xml.core
Class ExpressionBuilder
- java.lang.Object
-
- org.simpleframework.xml.core.ExpressionBuilder
-
class ExpressionBuilder extends java.lang.Object
TheExpressionBuilder
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:
PathParser
-
-
Field Summary
Fields Modifier and Type Field Description private Cache<Expression>
cache
This is the cache of path expressions previously built.private Format
format
This is the format used to style the path segments.private java.lang.Class
type
This is the type the expressions are being built for.
-
Constructor Summary
Constructors Constructor Description ExpressionBuilder(Detail detail, Support support)
Constructor for theExpressionBuilder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expression
build(java.lang.String path)
This is used to create anExpression
from the provided path.private Expression
create(java.lang.String path)
This is used to create anExpression
from the provided path.
-
-
-
Field Detail
-
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 java.lang.Class type
This is the type the expressions are being built for.
-
-
Constructor Detail
-
ExpressionBuilder
public ExpressionBuilder(Detail detail, Support support)
Constructor for theExpressionBuilder
. 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 expressionssupport
- this contains various support functions
-
-
Method Detail
-
build
public Expression build(java.lang.String path) throws java.lang.Exception
This is used to create anExpression
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:
java.lang.Exception
-
create
private Expression create(java.lang.String path) throws java.lang.Exception
This is used to create anExpression
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:
java.lang.Exception
-
-