Errai 3.0.1-SNAPSHOT

org.jboss.errai.jpa.client.local
Class TypedQueryFactory

java.lang.Object
  extended by org.jboss.errai.jpa.client.local.TypedQueryFactory

public abstract class TypedQueryFactory
extends Object

Factory class for creating TypedQuery instances. Used internally by EntityManager's createXXXQuery methods.

Author:
Jonathan Fuerth

Field Summary
protected  Class<?> actualResultType
           
protected  com.google.common.collect.ImmutableBiMap<String,javax.persistence.Parameter<?>> parameters
           
 
Constructor Summary
TypedQueryFactory(Class<?> actualResultType, ErraiParameter<?>[] parameters)
           
 
Method Summary
<T> javax.persistence.TypedQuery<T>
createIfCompatible(Class<T> resultType, ErraiEntityManager entityManager)
          Creates an instance of the TypedQuery associated with this factory if its result type is assignable to the given type.
protected abstract
<T> javax.persistence.TypedQuery<T>
createQuery(ErraiEntityManager entityManager)
          Subclasses must implement this method by returning a new instance of ErraiTypedQuery that implements the query logic for the JPA query handled by this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

actualResultType

protected final Class<?> actualResultType

parameters

protected final com.google.common.collect.ImmutableBiMap<String,javax.persistence.Parameter<?>> parameters
Constructor Detail

TypedQueryFactory

public TypedQueryFactory(Class<?> actualResultType,
                         ErraiParameter<?>[] parameters)
Method Detail

createIfCompatible

public <T> javax.persistence.TypedQuery<T> createIfCompatible(Class<T> resultType,
                                                              ErraiEntityManager entityManager)
Creates an instance of the TypedQuery associated with this factory if its result type is assignable to the given type.

Type Parameters:
T - The result type of the queries produced by this factory
Parameters:
resultType - The expected result type
entityManager - the EntityManager the query will be executed in. Must not be null.
Returns:
A new instance of TypedQuery, whose result type is assignable to resultType.
Throws:
IllegalArgumentException - if the query's result type is not assignable to the given type.

createQuery

protected abstract <T> javax.persistence.TypedQuery<T> createQuery(ErraiEntityManager entityManager)
Subclasses must implement this method by returning a new instance of ErraiTypedQuery that implements the query logic for the JPA query handled by this factory.

Parameters:
the - EntityManager the query will be executed in. Must not be null.
Returns:
a new instance of ErraiTypedQuery.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.