public class Injection
extends java.lang.Object
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 and Description |
---|
Injection() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getJndiName() |
java.lang.String |
getMappingName() |
java.lang.Class<?> |
getParamClass() |
java.lang.Class<?> |
getResourceClass() |
java.lang.reflect.Member |
getTarget() |
java.lang.Class<?> |
getTargetClass() |
void |
inject(java.lang.Object injectable)
Inject a value for a Resource from JNDI into an object
|
protected void |
injectField(java.lang.reflect.Field field,
java.lang.Object injectable)
Inject value from jndi into a field of an instance
|
protected void |
injectMethod(java.lang.reflect.Method method,
java.lang.Object injectable)
Inject value from jndi into a setter method of an instance
|
boolean |
isField() |
boolean |
isMethod() |
java.lang.Object |
lookupInjectedValue()
The Resource must already exist in the ENC of this webapp.
|
void |
setJndiName(java.lang.String jndiName) |
void |
setMappingName(java.lang.String mappingName) |
void |
setTarget(java.lang.Class<?> clazz,
java.lang.reflect.Field field,
java.lang.Class<?> resourceType) |
void |
setTarget(java.lang.Class<?> clazz,
java.lang.reflect.Method method,
java.lang.Class<?> arg,
java.lang.Class<?> resourceType) |
void |
setTarget(java.lang.Class<?> clazz,
java.lang.String target,
java.lang.Class<?> resourceType) |
public java.lang.Class<?> getTargetClass()
public java.lang.Class<?> getParamClass()
public java.lang.Class<?> getResourceClass()
public boolean isField()
public boolean isMethod()
public java.lang.String getJndiName()
public void setJndiName(java.lang.String jndiName)
jndiName
- the jndiName to setpublic java.lang.String getMappingName()
public void setMappingName(java.lang.String mappingName)
mappingName
- the mappingName to setpublic java.lang.reflect.Member getTarget()
public void setTarget(java.lang.Class<?> clazz, java.lang.reflect.Field field, java.lang.Class<?> resourceType)
public void setTarget(java.lang.Class<?> clazz, java.lang.reflect.Method method, java.lang.Class<?> arg, java.lang.Class<?> resourceType)
public void setTarget(java.lang.Class<?> clazz, java.lang.String target, java.lang.Class<?> resourceType)
public void inject(java.lang.Object injectable)
injectable
- the object to injectpublic java.lang.Object lookupInjectedValue() throws javax.naming.NamingException
javax.naming.NamingException
- if unable to lookup valueprotected void injectField(java.lang.reflect.Field field, java.lang.Object injectable)
field
- the field to inject intoinjectable
- the value to injectprotected void injectMethod(java.lang.reflect.Method method, java.lang.Object injectable)
method
- the method to inject intoinjectable
- the value to injectCopyright © 1995–2023 Webtide. All rights reserved.