Class 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.

    See Also:
    PropertyQueries, PropertyCriteria
    • Method Detail

      • 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 Map<String,​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 Map<String,​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