org.jboss.solder.properties.query
Class PropertyQuery<V>

java.lang.Object
  extended by org.jboss.solder.properties.query.PropertyQuery<V>

public class PropertyQuery<V>
extends Object

Queries a target class for properties that match certain criteria. A property may either be a private or public field, declared by the target class or inherited from a superclass, or a public method declared by the target class or inherited from any of its superclasses. For properties that are exposed via a method, the property must be a JavaBean style property, i.e. it must provide both an accessor and mutator method according to the JavaBean specification.

This class is not thread-safe, however the result returned by the getResultList() method is.

Author:
Shane Bryzak
See Also:
PropertyQueries, PropertyCriteria

Method Summary
 PropertyQuery<V> addCriteria(PropertyCriteria criteria)
          Add a criteria to query
 Property<V> getFirstResult()
          Get the first result from the query, causing the query to be run.
 Property<V> getFirstWritableResult()
          Get the first result from the query that is not marked as read only, causing the query to be run.
 List<Property<V>> getResultList()
          Get the result from the query, causing the query to be run.
 Property<V> getSingleResult()
          Get a single result from the query, causing the query to be run.
 List<Property<V>> getWritableResultList()
          Get the non read only results from the query, causing the query to be run.
 Property<V> getWritableSingleResult()
          Get a single result from the query that is not marked as read only, causing the query to be run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addCriteria

public PropertyQuery<V> addCriteria(PropertyCriteria criteria)
Add a criteria to query

Parameters:
criteria - the criteria to add

getFirstResult

public Property<V> getFirstResult()
Get the first result from the query, causing the query to be run.

Returns:
the first result, or null if there are no results

getFirstWritableResult

public Property<V> getFirstWritableResult()
Get the first result from the query that is not marked as read only, causing the query to be run.

Returns:
the first writable result, or null if there are no results

getSingleResult

public Property<V> getSingleResult()
Get a single result from the query, causing the query to be run. An exception is thrown if the query does not return exactly one result.

Returns:
the single result
Throws:
RuntimeException - if the query does not return exactly one result

getWritableSingleResult

public Property<V> getWritableSingleResult()
Get a single result from the query that is not marked as read only, causing the query to be run. An exception is thrown if the query does not return exactly one result.

Returns:
the single writable result
Throws:
RuntimeException - if the query does not return exactly one result

getResultList

public List<Property<V>> getResultList()
Get the result from the query, causing the query to be run.

Returns:
the results, or an empty list if there are no results

getWritableResultList

public List<Property<V>> getWritableResultList()
Get the non read only results from the query, causing the query to be run.

Returns:
the results, or an empty list if there are no results


Copyright © 2008-2011 Seam Framework. All Rights Reserved.