com.stvconsultants.easygloss.javaee
Class JavaEEGloss

java.lang.Object
  extended by com.stvconsultants.easygloss.AbstractGloss
      extended by com.stvconsultants.easygloss.javaee.JavaEEGloss

public class JavaEEGloss
extends AbstractGloss

A gloss for applying to JavaEE annotated classes.

Author:
Stephen Connolly

Constructor Summary
JavaEEGloss()
          Creates a new instance of JavaEEGloss
 
Method Summary
 void addEJB(java.lang.Object beanImpl)
          Add a default EJB to the gloss.
 void addEJB(java.lang.String name, java.lang.Object beanImpl)
          Add a specific EJB to the gloss.
 void addEJB(java.lang.String name, java.lang.String beanName, java.lang.Class beanInterface, java.lang.Object beanImpl)
          Add a specific EJB to the gloss.
 void addEM(javax.persistence.EntityManager em)
          Add a default entity manager to the gloss.
 void addEM(java.lang.String unitName, javax.persistence.EntityManager em)
          Add an entity manager to the gloss.
 void addEMF(javax.persistence.EntityManagerFactory emf)
          Add a default entity manager factory to the gloss.
 void addEMF(java.lang.String unitName, javax.persistence.EntityManagerFactory emf)
          Add an entity manager factory to the gloss.
 void addGenericEJB(java.lang.Object beanImpl)
          Add a general EJB to the gloss.
 void addGenericEM(javax.persistence.EntityManager em)
          Add a general entity manager to the gloss.
 void addGenericEMF(javax.persistence.EntityManagerFactory emf)
          Add a general entity manager factory to the gloss.
 void addGenericResource(java.lang.Object resource)
          Add a general resource to the gloss.
 void addResource(java.lang.Object resource)
          Add a default resource to the gloss.
 void addResource(java.lang.String name, java.lang.Class type, java.lang.Object resource)
          Add a specific resource to the gloss.
 void addResource(java.lang.String name, java.lang.Object resource)
          Add a specific resource to the gloss.
 void afterActivate(java.lang.Object instance)
          Invoke any @PostActivate annotated callbacks in the instance.
 void afterLoad(java.lang.Object instance)
          Invoke any @PostLoad annotated callbacks in the instance.
 void afterPersist(java.lang.Object instance)
          Invoke any @PostPersist annotated callbacks in the instance.
 void afterRemove(java.lang.Object instance)
          Invoke any @PostRemove annotated callbacks in the instance.
 void afterUpdate(java.lang.Object instance)
          Invoke any @PostUpdate annotated callbacks in the instance.
 void apply(java.lang.Object instance)
          Apply the gloss to the instance.
 void applyStatic(java.lang.Class instanceClass)
          Apply the gloss to the class
 void beforeDestroy(java.lang.Object instance)
          Invoke any @PreDestroy annotated callbacks in the instance.
 void beforePassivate(java.lang.Object instance)
          Invoke any @PrePassivate annotated callbacks in the instance.
 void beforePersist(java.lang.Object instance)
          Invoke any @PrePersist annotated callbacks in the instance.
 void beforeRemove(java.lang.Object instance)
          Invoke any @PreRemove annotated callbacks in the instance.
 void beforeUpdate(java.lang.Object instance)
          Invoke any @PreUpdate annotated callbacks in the instance.
 boolean equals(java.lang.Object obj)
          Compare this instance with another instance.
 int hashCode()
          Calculate the hashCode for this instance.
<T> T
make(java.lang.Class<T> type)
          Create a new instance of T and apply the gloss to it.
 java.lang.String toString()
          Generate a string representation of this gloss.
 
Methods inherited from class com.stvconsultants.easygloss.AbstractGloss
apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, applyStatic, filter, filter, filterGetters, filterSetters, findFields, findMethods, findSetter, invoke, invoke, invoke, matchParameters
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaEEGloss

public JavaEEGloss()
Creates a new instance of JavaEEGloss

Method Detail

make

public <T> T make(java.lang.Class<T> type)
Create a new instance of T and apply the gloss to it. Throws GlossApplicationError if anything goes wrong.

Parameters:
type - The class type to create.
Returns:
A freshly glossed instance of class T.

addEM

public void addEM(javax.persistence.EntityManager em)
Add a default entity manager to the gloss. That is, one that will only match @PersistenceContext() EntityManager or appropriate setter method.

Parameters:
em - The EntityManager to inject

addGenericEM

public void addGenericEM(javax.persistence.EntityManager em)
Add a general entity manager to the gloss. That is, one that will match any @PersistenceContext annotated EntityManager or appropriate setter method.

Parameters:
em - The EntityManager to inject

addEM

public void addEM(java.lang.String unitName,
                  javax.persistence.EntityManager em)
Add an entity manager to the gloss. That is, one that will only match @PersistenceContext(unitName="unitName") EntityManager or appropriate setter method.

Parameters:
unitName - The unitName to inject for (if null => match any)
em - The EntityManager to inject

addEMF

public void addEMF(javax.persistence.EntityManagerFactory emf)
Add a default entity manager factory to the gloss. That is, one that will only match @PersistenceUnit() EntityManagerFactory or appropriate setter method.

Parameters:
emf - The EntityManagerFactory to inject

addGenericEMF

public void addGenericEMF(javax.persistence.EntityManagerFactory emf)
Add a general entity manager factory to the gloss. That is, one that will match any @PersistenceUnit annotated EntityManagerFactory or appropriate setter method.

Parameters:
emf - The EntityManagerFactory to inject

addEMF

public void addEMF(java.lang.String unitName,
                   javax.persistence.EntityManagerFactory emf)
Add an entity manager factory to the gloss. That is, one that will only match @PersistenceUnit(unitName="unitName") EntityManagerFactory or appropriate setter method.

Parameters:
unitName - The unitName to inject for (if null => match any)
emf - The EntityManagerFactory to inject

addEJB

public void addEJB(java.lang.Object beanImpl)
Add a default EJB to the gloss. That is, one that will match any @EJB() annotated field, property or setter method with which the beanImpl is assignment compatable.

Parameters:
beanImpl - The implementation to inject.

addGenericEJB

public void addGenericEJB(java.lang.Object beanImpl)
Add a general EJB to the gloss. That is, one that will match any @EJB() annotated field, property or setter method with which the beanImpl is assignment compatable.

Parameters:
beanImpl - The implementation to inject.

addEJB

public void addEJB(java.lang.String name,
                   java.lang.Object beanImpl)
Add a specific EJB to the gloss. That is, one that will match any @EJB(name="name") annotated field, property or setter method with which the beanImpl is assignment compatable.

Parameters:
name - The name to match (if null => match any)
beanImpl - The implementation to inject.

addEJB

public void addEJB(java.lang.String name,
                   java.lang.String beanName,
                   java.lang.Class beanInterface,
                   java.lang.Object beanImpl)
Add a specific EJB to the gloss. That is, one that will match any @EJB(name="name", beanName="beanName", beanInterface=beanInterface) annotated field, property or setter method with which the beanImpl is assignment compatable.

Parameters:
name - The name to match (if null => match any)
beanName - The beanName to match (if null => match any)
beanInterface - The beanInterface to match (if null => match any)
beanImpl - The implementation to inject.

addResource

public void addResource(java.lang.Object resource)
Add a default resource to the gloss. That is, one that will match any @Resource() annotated field, property or setter method with which the resource is assignment compatable.

Parameters:
resource - The resource to inject.

addGenericResource

public void addGenericResource(java.lang.Object resource)
Add a general resource to the gloss. That is, one that will match any @Resource() annotated field, property or setter method with which the resource is assignment compatable.

Parameters:
resource - The resource to inject.

addResource

public void addResource(java.lang.String name,
                        java.lang.Object resource)
Add a specific resource to the gloss. That is, one that will match any @Resource(name="name") annotated field, property or setter method with which the resource is assignment compatable.

Parameters:
name - The name to match (if null => match any)
resource - The resource to inject.

addResource

public void addResource(java.lang.String name,
                        java.lang.Class type,
                        java.lang.Object resource)
Add a specific resource to the gloss. That is, one that will match any @Resource(name="name", type=type) annotated field, property or setter method with which the resource is assignment compatable.

Parameters:
name - The name to match (if null => match any)
type - The type to match (if null => match any)
resource - The resource to inject.

apply

public void apply(java.lang.Object instance)
Apply the gloss to the instance. The @PostConstruct annotated method (if present) will be called after application of the gloss.

Specified by:
apply in class AbstractGloss
Parameters:
instance - The instance to apply the gloss to.

applyStatic

public void applyStatic(java.lang.Class instanceClass)
Apply the gloss to the class

Specified by:
applyStatic in class AbstractGloss
Parameters:
instanceClass - The class to which the gloss should be applied

afterActivate

public void afterActivate(java.lang.Object instance)
Invoke any @PostActivate annotated callbacks in the instance.

Parameters:
instance - The instance to invoke.

afterLoad

public void afterLoad(java.lang.Object instance)
Invoke any @PostLoad annotated callbacks in the instance.

Parameters:
instance - The instance to invoke.

afterPersist

public void afterPersist(java.lang.Object instance)
Invoke any @PostPersist annotated callbacks in the instance.

Parameters:
instance - The instance to invoke.

afterRemove

public void afterRemove(java.lang.Object instance)
Invoke any @PostRemove annotated callbacks in the instance.

Parameters:
instance - The instance to invoke.

afterUpdate

public void afterUpdate(java.lang.Object instance)
Invoke any @PostUpdate annotated callbacks in the instance.

Parameters:
instance - The instance to invoke.

beforeDestroy

public void beforeDestroy(java.lang.Object instance)
Invoke any @PreDestroy annotated callbacks in the instance.

Parameters:
instance - The instance to invoke.

beforePassivate

public void beforePassivate(java.lang.Object instance)
Invoke any @PrePassivate annotated callbacks in the instance.

Parameters:
instance - The instance to invoke.

beforePersist

public void beforePersist(java.lang.Object instance)
Invoke any @PrePersist annotated callbacks in the instance.

Parameters:
instance - The instance to invoke.

beforeRemove

public void beforeRemove(java.lang.Object instance)
Invoke any @PreRemove annotated callbacks in the instance.

Parameters:
instance - The instance to invoke.

beforeUpdate

public void beforeUpdate(java.lang.Object instance)
Invoke any @PreUpdate annotated callbacks in the instance.

Parameters:
instance - The instance to invoke.

toString

public java.lang.String toString()
Generate a string representation of this gloss.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Compare this instance with another instance.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The instance to compare with.

hashCode

public int hashCode()
Calculate the hashCode for this instance.

Overrides:
hashCode in class java.lang.Object


Copyright © 2006 null. All Rights Reserved.