com.amazon.carbonado.filter
Class ExistsFilter<S extends Storable>

java.lang.Object
  extended by com.amazon.carbonado.filter.Filter<S>
      extended by com.amazon.carbonado.filter.ExistsFilter<S>
All Implemented Interfaces:
Appender, Serializable

public class ExistsFilter<S extends Storable>
extends Filter<S>

Filter tree node that performs an existence or non-existence test against a join property.

Since:
1.2
Author:
Brian S O'Neill
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.amazon.carbonado.filter.Filter
Filter.NotJoined
 
Method Summary
<R,P> R
accept(Visitor<S,R,P> visitor, P param)
          Accept the given visitor subclass to traverse the filter tree.
 void appendTo(Appendable app, FilterValues<S> values)
          Appends the string value of this filter into the given Appendable.
<T extends Storable>
ExistsFilter<T>
asJoinedFromAny(ChainedProperty<T> joinProperty)
          Allows join from any property type, including one-to-many joins.
 ExistsFilter<S> bind()
          Walks through each property filter, assigning a bind ID to it.
 boolean equals(Object obj)
           
 ChainedProperty<S> getChainedProperty()
          Returns the join property that is being checked for existence or non-existence.
 Filter<?> getSubFilter()
          Returns the filter applied to the join, which might be open.
 FilterValues<S> initialFilterValues()
          Returns a FilterValues instance for assigning values to a Filter.
 boolean isBound()
          Returns true if all property filters are known to be properly bound.
 boolean isNotExists()
           
 Filter<S> not()
          Returns the logical negation of this filter.
 ExistsFilter<S> unbind()
          Undoes the effect of a bind operation.
 
Methods inherited from class com.amazon.carbonado.filter.Filter
and, and, and, and, andExists, andNotExists, appendTo, asJoinedFrom, asJoinedFrom, conjunctiveNormalForm, conjunctiveNormalFormSplit, disjunctiveNormalForm, disjunctiveNormalFormSplit, filterFor, getClosedFilter, getOpenFilter, getStorableType, hashCode, isClosed, isOpen, notJoinedFrom, notJoinedFrom, or, or, or, or, orExists, orNotExists, reduce, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getChainedProperty

public ChainedProperty<S> getChainedProperty()
Returns the join property that is being checked for existence or non-existence. The last property in the chain is a one-to-many or many-to-one join, but it is a many-to-one join only if the sub-filter is also open.

Returns:
chained property whose last property is a join

getSubFilter

public Filter<?> getSubFilter()
Returns the filter applied to the join, which might be open. For a many-to-one join, the sub-filter is always open.

Returns:
filter which is applied to last property of chain

isNotExists

public boolean isNotExists()
Returns:
true if this filter is testing for "not exists"

not

public Filter<S> not()
Description copied from class: Filter
Returns the logical negation of this filter.

Specified by:
not in class Filter<S extends Storable>
Returns:
canonical Filter instance

initialFilterValues

public FilterValues<S> initialFilterValues()
Description copied from class: Filter
Returns a FilterValues instance for assigning values to a Filter. Returns null if Filter has no parameters.

Note: The returned FilterValues instance may reference a different filter instance than this one. Call getFilter to retrieve it. The difference is caused by the filter property values being bound.

Overrides:
initialFilterValues in class Filter<S extends Storable>

accept

public <R,P> R accept(Visitor<S,R,P> visitor,
                      P param)
Description copied from class: Filter
Accept the given visitor subclass to traverse the filter tree.

Specified by:
accept in class Filter<S extends Storable>
Parameters:
visitor - visitor to traverse through the tree
param - generic input parameter passed to visit methods
Returns:
generic return value passed from visit methods

bind

public ExistsFilter<S> bind()
Description copied from class: Filter
Walks through each property filter, assigning a bind ID to it. This step is automatically performed for proper dnf/cnf conversion, and for building FilterValues.

Specified by:
bind in class Filter<S extends Storable>
Returns:
canonical Filter instance with bound property filters

unbind

public ExistsFilter<S> unbind()
Description copied from class: Filter
Undoes the effect of a bind operation. The returned filter might still report itself as bound if it doesn't make a distinction between these states.

Specified by:
unbind in class Filter<S extends Storable>
Returns:
canonical Filter instance with unbound property filters

isBound

public boolean isBound()
Description copied from class: Filter
Returns true if all property filters are known to be properly bound. This is a side effect of calling Filter.bind(), Filter.initialFilterValues(), Filter.disjunctiveNormalForm() or Filter.conjunctiveNormalForm().

Specified by:
isBound in class Filter<S extends Storable>

asJoinedFromAny

public <T extends Storable> ExistsFilter<T> asJoinedFromAny(ChainedProperty<T> joinProperty)
Description copied from class: Filter
Allows join from any property type, including one-to-many joins.

Specified by:
asJoinedFromAny in class Filter<S extends Storable>

equals

public boolean equals(Object obj)
Specified by:
equals in class Filter<S extends Storable>

appendTo

public void appendTo(Appendable app,
                     FilterValues<S> values)
              throws IOException
Description copied from class: Filter
Appends the string value of this filter into the given Appendable.

Specified by:
appendTo in class Filter<S extends Storable>
values - optionally supply filter values
Throws:
IOException


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.