org.geotools.filter.expression
Class ChildExpressionBuilder<P extends Builder<?>>

Object
  extended by ExpressionBuilder
      extended by ChildExpressionBuilder<P>
Type Parameters:
P - parent builder
All Implemented Interfaces:
Builder<Expression>

public class ChildExpressionBuilder<P extends Builder<?>>
extends ExpressionBuilder

Child expression builder; suitable for use collecting function parameters and binary expression arguments.

This builder is designed to be "chained" from a parent builder; you may return to the parent builder at any time by calling end().


Field Summary
 
Fields inherited from class ExpressionBuilder
delegate, ff, unset
 
Constructor Summary
ChildExpressionBuilder(P parent)
           
ChildExpressionBuilder(P parent, Expression expr1)
           
 
Method Summary
 Expression build()
          Build the parameter; adding it to the parent.
 P end()
          Build the expression and return to the parent builder.
 P literal(Object obj)
          Inline literal value.
 P property(String xpath)
          Inline property name value.
 ChildExpressionBuilder<P> reset()
          Configure the Builder to produce a default result.
 ChildExpressionBuilder<P> reset(Expression original)
          Configure the Builder to produce a copy of the provided original.
 ChildExpressionBuilder<P> unset()
          Configure the Builder to produce null.
 
Methods inherited from class ExpressionBuilder
add, divide, function, function, isUnset, literal, multiply, property, subtract
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChildExpressionBuilder

public ChildExpressionBuilder(P parent)

ChildExpressionBuilder

public ChildExpressionBuilder(P parent,
                              Expression expr1)
Method Detail

reset

public ChildExpressionBuilder<P> reset()
Description copied from interface: Builder
Configure the Builder to produce a default result.

Specified by:
reset in interface Builder<Expression>
Overrides:
reset in class ExpressionBuilder
Returns:
Builder configured to produce a default result.

reset

public ChildExpressionBuilder<P> reset(Expression original)
Description copied from interface: Builder
Configure the Builder to produce a copy of the provided original.

Specified by:
reset in interface Builder<Expression>
Overrides:
reset in class ExpressionBuilder
Returns:
Builder configured to produce the provided original

unset

public ChildExpressionBuilder<P> unset()
Description copied from interface: Builder
Configure the Builder to produce null.

This method allows a Builder to be used as a placeholder; in its unset state the build() method will produce null. If any of the builder methods are used the builder will produce a result.

Specified by:
unset in interface Builder<Expression>
Overrides:
unset in class ExpressionBuilder
Returns:
Builder configured to build null

build

public Expression build()
Build the parameter; adding it to the parent.

When using this from another builder you may wish to override the this build() method as shown below:

 final Expression array[] = ...
 ChildExpressionBuilder first = new ChildExpressionBuilder<?>(this) {            
      public Expression build() {
          array[0] = super.build();
          return array[0];
      }
  };
 }
 

Specified by:
build in interface Builder<Expression>
Overrides:
build in class ExpressionBuilder
Returns:
internal expression

end

public P end()
Build the expression and return to the parent builder.

Example use:b.add().expr1().literal(1).end().expr2().literal(2).end().build();

Returns:
See Also:
_build()

literal

public P literal(Object obj)
Inline literal value.

Example:b.literal( 1 );

Overrides:
literal in class ExpressionBuilder
Parameters:
obj - Object to use as the resulting literal

property

public P property(String xpath)
Inline property name value.

Example:b.property("x");

Overrides:
property in class ExpressionBuilder


Copyright © 1996-2014 Geotools. All Rights Reserved.