Class Injection
- java.lang.Object
-
- org.eclipse.jetty.plus.annotation.Injection
-
public class Injection extends java.lang.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.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
_jndiName
private java.lang.String
_mappingName
private java.lang.Class<?>
_paramClass
private java.lang.Class<?>
_resourceClass
private java.lang.reflect.Member
_target
private java.lang.Class<?>
_targetClass
private static Logger
LOG
-
Constructor Summary
Constructors Constructor Description Injection(java.lang.Class<?> clazz, java.lang.reflect.Field field, java.lang.Class<?> resourceType, java.lang.String jndiName, java.lang.String mappingName)
Injection(java.lang.Class<?> clazz, java.lang.reflect.Method method, java.lang.Class<?> arg, java.lang.Class<?> resourceType, java.lang.String jndiName, java.lang.String mappingName)
Injection(java.lang.Class<?> clazz, java.lang.String target, java.lang.Class<?> resourceType, java.lang.String jndiName, java.lang.String mappingName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 objectprotected void
injectField(java.lang.reflect.Field field, java.lang.Object injectable)
Inject value from jndi into a field of an instanceprotected void
injectMethod(java.lang.reflect.Method method, java.lang.Object injectable)
Inject value from jndi into a setter method of an instanceboolean
isField()
boolean
isMethod()
java.lang.Object
lookupInjectedValue()
The Resource must already exist in the ENC of this webapp.
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
_targetClass
private final java.lang.Class<?> _targetClass
-
_jndiName
private final java.lang.String _jndiName
-
_mappingName
private final java.lang.String _mappingName
-
_target
private final java.lang.reflect.Member _target
-
_paramClass
private final java.lang.Class<?> _paramClass
-
_resourceClass
private final java.lang.Class<?> _resourceClass
-
-
Constructor Detail
-
Injection
public Injection(java.lang.Class<?> clazz, java.lang.reflect.Field field, java.lang.Class<?> resourceType, java.lang.String jndiName, java.lang.String mappingName)
-
Injection
public Injection(java.lang.Class<?> clazz, java.lang.reflect.Method method, java.lang.Class<?> arg, java.lang.Class<?> resourceType, java.lang.String jndiName, java.lang.String mappingName)
-
Injection
public Injection(java.lang.Class<?> clazz, java.lang.String target, java.lang.Class<?> resourceType, java.lang.String jndiName, java.lang.String mappingName)
-
-
Method Detail
-
getTargetClass
public java.lang.Class<?> getTargetClass()
- Returns:
- the _className
-
getParamClass
public java.lang.Class<?> getParamClass()
-
getResourceClass
public java.lang.Class<?> getResourceClass()
-
isField
public boolean isField()
-
isMethod
public boolean isMethod()
-
getJndiName
public java.lang.String getJndiName()
- Returns:
- the jndiName
-
getMappingName
public java.lang.String getMappingName()
- Returns:
- the mappingName
-
getTarget
public java.lang.reflect.Member getTarget()
- Returns:
- the target
-
inject
public void inject(java.lang.Object injectable)
Inject a value for a Resource from JNDI into an object- Parameters:
injectable
- the object to inject
-
lookupInjectedValue
public java.lang.Object lookupInjectedValue() throws javax.naming.NamingException
The Resource must already exist in the ENC of this webapp.- Returns:
- the injected valud
- Throws:
javax.naming.NamingException
- if unable to lookup value
-
injectField
protected void injectField(java.lang.reflect.Field field, java.lang.Object injectable)
Inject value from jndi into a field of an instance- Parameters:
field
- the field to inject intoinjectable
- the value to inject
-
injectMethod
protected void injectMethod(java.lang.reflect.Method method, java.lang.Object injectable)
Inject value from jndi into a setter method of an instance- Parameters:
method
- the method to inject intoinjectable
- the value to inject
-
-