Holger's Java API

## com.antelmann.util
Interface QueryMechanism

All Known Subinterfaces:
  OfficeDocument

All Known Implementing Classes:
  AbstractDatabase, AbstractOfficeDocument, GDB, Logger, OOCalc, OODraw, OOWriter, OpenGeoDB, SQLDatabase, SQLFactoryDatabase

    public interface QueryMechanism

provides a generic way to query an object for flexible functionality

Since:
  21.10.2009, 17:38:52
Author:
  Holger Antelmann

Method Summary

`

`<T> T`

`

`query(Class<T> requiredReturnType, Object context)`
queries the instance for an object of the given type that is appropriate for the given context.

Method Detail

### query

    <T> T query(Class<T> requiredReturnType,
                Object context)
            throws IOException,
                   IllegalArgumentException

  queries the instance for an object of the given type that is appropriate for the given context.

  Type Parameters:
    `T` - the required return type
  Parameters:
    `requiredReturnType` - specifies the return type that is needed for this operation; if Object.class is given, any returned object is admissible
    `context` - provides a context parameter for which the desired instance is to be returned. Often (if no other meaningful context is required or applicable), it makes sense to pass a reference to the calling object source; null may also be allowed
  Returns:
    an instance of the required return type that matches the given context; null may be returned if no instance is available for the given context
  Throws:
    `IOException` - if any resource could not be acquired to fulfill the given query
    `IllegalArgumentException` - if either parameter is generally not acceptable by the implementation

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads