org.joda.beans.query
Class ChainedBeanQuery<P>

java.lang.Object
  extended by org.joda.beans.query.ChainedBeanQuery<P>
Type Parameters:
P - the type of the result of the query
All Implemented Interfaces:
BeanQuery<P>

public final class ChainedBeanQuery<P>
extends Object
implements BeanQuery<P>

A chained query, that allows two or more queries to be joined.

For example, consider a structure where class A has a property b of type B, and class B has a property c of type C. The compound query allows property c to be accessed directly from an instance of A.


Method Summary
 P get(Bean bean)
          Queries a value from the specified bean.
 List<BeanQuery<?>> getChain()
          Gets the list of queries being chained.
static
<P> ChainedBeanQuery<P>
of(BeanQuery<? extends Bean> prop1, BeanQuery<? extends Bean> prop2, BeanQuery<? extends Bean> prop3, BeanQuery<P> prop4)
          Obtains a chained query from four queries.
static
<P> ChainedBeanQuery<P>
of(BeanQuery<? extends Bean> prop1, BeanQuery<? extends Bean> prop2, BeanQuery<P> prop3)
          Obtains a chained query from three queries.
static
<P> ChainedBeanQuery<P>
of(BeanQuery<? extends Bean> prop1, BeanQuery<P> prop2)
          Obtains a chained query from two other queries.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

of

public static <P> ChainedBeanQuery<P> of(BeanQuery<? extends Bean> prop1,
                                         BeanQuery<P> prop2)
Obtains a chained query from two other queries.

MetaProperty implements BeanQuery, so typically the parameters are in fact meta-properties.

Type Parameters:
P - the result type
Parameters:
prop1 - the first query, not null
prop2 - the second query, not null
Returns:
the compound query, not null
Throws:
IllegalArgumentException - if unable to obtain the meta-bean

of

public static <P> ChainedBeanQuery<P> of(BeanQuery<? extends Bean> prop1,
                                         BeanQuery<? extends Bean> prop2,
                                         BeanQuery<P> prop3)
Obtains a chained query from three queries.

MetaProperty implements BeanQuery, so typically the parameters are in fact meta-properties.

Type Parameters:
P - the result type
Parameters:
prop1 - the first query, not null
prop2 - the second query, not null
prop3 - the third query, not null
Returns:
the compound query, not null
Throws:
IllegalArgumentException - if unable to obtain the meta-bean

of

public static <P> ChainedBeanQuery<P> of(BeanQuery<? extends Bean> prop1,
                                         BeanQuery<? extends Bean> prop2,
                                         BeanQuery<? extends Bean> prop3,
                                         BeanQuery<P> prop4)
Obtains a chained query from four queries.

MetaProperty implements BeanQuery, so typically the parameters are in fact meta-properties.

Type Parameters:
P - the result type
Parameters:
prop1 - the first query, not null
prop2 - the second query, not null
prop3 - the third query, not null
prop4 - the fourth query, not null
Returns:
the compound query, not null
Throws:
IllegalArgumentException - if unable to obtain the meta-bean

getChain

public List<BeanQuery<?>> getChain()
Gets the list of queries being chained.

MetaProperty implements BeanQuery, so typically the chain is formed from meta-properties.

Returns:
the list of all meta-properties being chained, not null

get

public P get(Bean bean)
Description copied from interface: BeanQuery
Queries a value from the specified bean.

This returns a value of some kind derived from the specified bean. This might be a property value or some other derived value.

Specified by:
get in interface BeanQuery<P>
Parameters:
bean - the bean to query, not null
Returns:
the value derived from the specified bean, may be null

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007–2017 Joda.org. All rights reserved.