Class Injection
java.lang.Object
org.eclipse.jetty.plus.annotation.Injection
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
-
Method Summary
Modifier and TypeMethodDescriptionGet the jndiName.Class<?>
Class<?>
Get the target.Class<?>
void
Inject a value for a Resource from JNDI into an objectprotected void
injectField
(Field field, Object injectable) Inject value from jndi into a field of an instanceprotected void
injectMethod
(Method method, Object injectable) Inject value from jndi into a setter method of an instanceboolean
isField()
boolean
isMethod()
The Resource must already exist in the ENC of this webapp.
-
Constructor Details
-
Injection
-
Injection
-
Injection
-
-
Method Details
-
getTargetClass
- Returns:
- the _className
-
getParamClass
-
getResourceClass
-
isField
public boolean isField() -
isMethod
public boolean isMethod() -
getJndiName
Get the jndiName.- Returns:
- the jndiName
-
getMappingName
- Returns:
- the mappingName
-
getTarget
Get the target.- Returns:
- the target
-
inject
Inject a value for a Resource from JNDI into an object- Parameters:
injectable
- the object to inject
-
lookupInjectedValue
The Resource must already exist in the ENC of this webapp.- Returns:
- the injected valud
- Throws:
NamingException
- if unable to lookup value
-
injectField
Inject value from jndi into a field of an instance- Parameters:
field
- the field to inject intoinjectable
- the value to inject
-
injectMethod
Inject value from jndi into a setter method of an instance- Parameters:
method
- the method to inject intoinjectable
- the value to inject
-