Class Injection
- java.lang.Object
-
- org.eclipse.jetty.plus.annotation.Injection
-
public class Injection extends Object
InjectionRepresents 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
Constructors Constructor Description Injection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetJndiName()StringgetMappingName()Class<?>getParamClass()Class<?>getResourceClass()MembergetTarget()Class<?>getTargetClass()voidinject(Object injectable)Inject a value for a Resource from JNDI into an objectprotected voidinjectField(Field field, Object injectable)Inject value from jndi into a field of an instanceprotected voidinjectMethod(Method method, Object injectable)Inject value from jndi into a setter method of an instancebooleanisField()booleanisMethod()ObjectlookupInjectedValue()The Resource must already exist in the ENC of this webapp.voidsetJndiName(String jndiName)voidsetMappingName(String mappingName)voidsetTarget(Class<?> clazz, Field field, Class<?> resourceType)voidsetTarget(Class<?> clazz, Method method, Class<?> arg, Class<?> resourceType)voidsetTarget(Class<?> clazz, String target, Class<?> resourceType)
-
-
-
Method Detail
-
getTargetClass
public Class<?> getTargetClass()
- Returns:
- the _className
-
getParamClass
public Class<?> getParamClass()
-
getResourceClass
public Class<?> getResourceClass()
-
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(Class<?> clazz, Method method, Class<?> arg, Class<?> resourceType)
-
inject
public void inject(Object injectable)
Inject a value for a Resource from JNDI into an object- Parameters:
injectable- the object to inject
-
lookupInjectedValue
public Object lookupInjectedValue() throws NamingException
The Resource must already exist in the ENC of this webapp.- Returns:
- the injected valud
- Throws:
NamingException- if unable to lookup value
-
injectField
protected void injectField(Field field, Object injectable)
Inject value from jndi into a field of an instance- Parameters:
field- the field to inject intoinjectable- the value to inject
-
-