org.eclipse.jetty.plus.annotation
Class Injection

java.lang.Object
  extended by org.eclipse.jetty.plus.annotation.Injection

public class Injection
extends Object

Injection Represents the injection of a resource into a target (method or field). The injection is performed by doing an ENC lookup using the jndi name provided, and setting the object obtained on the target.


Constructor Summary
Injection()
           
 
Method Summary
 String getFieldName()
           
 String getJndiName()
           
 String getMappingName()
           
 String getMethodName()
           
 String getParamCanonicalName()
           
 Member getTarget()
           
 Class getTargetClass()
           
 String getTargetClassName()
           
 void inject(Object injectable)
          Inject a value for a Resource from JNDI into an object
protected  void injectField(Field field, Object injectable)
          Inject value from jndi into a field of an instance
protected  void injectMethod(Method method, Object injectable)
          Inject value from jndi into a setter method of an instance
 boolean isField()
           
 boolean isMethod()
           
protected  void loadField()
           
protected  void loadMethod()
          Load the target class and method.
 Object lookupInjectedValue()
          The Resource must already exist in the ENC of this webapp.
 void setJndiName(String jndiName)
           
 void setMappingName(String mappingName)
           
 void setTarget(Class clazz, String targetName, Class targetType)
           
 void setTarget(String className, String fieldName, String annotationResourceType)
          Set up an injection target that is a field
 void setTarget(String className, String methodName, String paramCanonicalName, String annotationResourceType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Injection

public Injection()
Method Detail

getTargetClass

public Class getTargetClass()
Returns:
the _className

getTargetClassName

public String getTargetClassName()

getFieldName

public String getFieldName()

getMethodName

public String getMethodName()

getParamCanonicalName

public String getParamCanonicalName()

isField

public boolean isField()

isMethod

public boolean isMethod()

getJndiName

public String getJndiName()
Returns:
the jndiName

setJndiName

public void setJndiName(String jndiName)
Parameters:
jndiName - the jndiName to set

getMappingName

public String getMappingName()
Returns:
the mappingName

setMappingName

public void setMappingName(String mappingName)
Parameters:
mappingName - the mappingName to set

getTarget

public Member getTarget()
Returns:
the target

setTarget

public void setTarget(String className,
                      String fieldName,
                      String annotationResourceType)
Set up an injection target that is a field

Parameters:
className -
fieldName -

setTarget

public void setTarget(String className,
                      String methodName,
                      String paramCanonicalName,
                      String annotationResourceType)

setTarget

public void setTarget(Class clazz,
                      String targetName,
                      Class targetType)

inject

public void inject(Object injectable)
Inject a value for a Resource from JNDI into an object

Parameters:
injectable -

lookupInjectedValue

public Object lookupInjectedValue()
                           throws NamingException
The Resource must already exist in the ENC of this webapp.

Returns:
the injected valud
Throws:
NamingException

injectField

protected void injectField(Field field,
                           Object injectable)
Inject value from jndi into a field of an instance

Parameters:
field -
injectable -

injectMethod

protected void injectMethod(Method method,
                            Object injectable)
Inject value from jndi into a setter method of an instance

Parameters:
method -
injectable -

loadField

protected void loadField()
                  throws ClassNotFoundException,
                         NoSuchFieldException
Throws:
ClassNotFoundException
NoSuchFieldException

loadMethod

protected void loadMethod()
                   throws ClassNotFoundException,
                          NoSuchMethodException
Load the target class and method. A valid injection target method only has 1 argument.

Throws:
ClassNotFoundException
NoSuchMethodException


Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.