Top Description Fields Constructors Methods
org.eclipse.jetty.plus.annotation

public Class Injection

extends Object
Class Inheritance
Imports
java.lang.reflect.Field, .Member, .Method, java.util.Locale, .Objects, javax.naming.InitialContext, .NamingException, org.eclipse.jetty.util.IntrospectionUtil, org.slf4j.Logger, .LoggerFactory

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.

Field Summary

Modifier and TypeField and Description
private final String
private final String
private final Class<?>
private final Class<?>
private final Member
private final Class<?>
private static final Logger

Constructor Summary

AccessConstructor and Description
public
Injection(Class<?> clazz, Field field, Class<?> resourceType, String jndiName, String mappingName)

public
Injection(Class<?> clazz, Method method, Class<?> arg, Class<?> resourceType, String jndiName, String mappingName)

public
Injection(Class<?> clazz, String target, Class<?> resourceType, String jndiName, String mappingName)

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the jndiName
getJndiName
()

Get the jndiName.

public String
getMappingName()

Returns: the mappingName

public Class<?>
public Class<?>
public Member

Returns:

the target
getTarget
()

Get the target.

public Class<?>
getTargetClass()

Returns: the _className

public void
inject(Object
the object to inject
injectable
)

Inject a value for a Resource from JNDI into an object

protected void
injectField(Field
the field to inject into
field
,
Object
the value to inject
injectable
)

Inject value from jndi into a field of an instance

protected void
injectMethod(Method
the method to inject into
method
,
Object
the value to inject
injectable
)

Inject value from jndi into a setter method of an instance

public boolean
public boolean
public Object

Returns:

the injected valud
lookupInjectedValue
()

The Resource must already exist in the ENC of this webapp.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_jndiNameback to summary
private final String _jndiName
_mappingNameback to summary
private final String _mappingName
_paramClassback to summary
private final Class<?> _paramClass
_resourceClassback to summary
private final Class<?> _resourceClass
_targetback to summary
private final Member _target
_targetClassback to summary
private final Class<?> _targetClass
LOGback to summary
private static final Logger LOG

Constructor Detail

Injectionback to summary
public Injection(Class<?> clazz, Field field, Class<?> resourceType, String jndiName, String mappingName)
Injectionback to summary
public Injection(Class<?> clazz, Method method, Class<?> arg, Class<?> resourceType, String jndiName, String mappingName)
Injectionback to summary
public Injection(Class<?> clazz, String target, Class<?> resourceType, String jndiName, String mappingName)

Method Detail

getJndiNameback to summary
public String getJndiName()

Get the jndiName.

Returns:String

the jndiName

getMappingNameback to summary
public String getMappingName()
Returns:String

the mappingName

getParamClassback to summary
public Class<?> getParamClass()
getResourceClassback to summary
public Class<?> getResourceClass()
getTargetback to summary
public Member getTarget()

Get the target.

Returns:Member

the target

getTargetClassback to summary
public Class<?> getTargetClass()
Returns:Class<?>

the _className

injectback to summary
public void inject(Object injectable)

Inject a value for a Resource from JNDI into an object

Parameters
injectable:Object

the object to inject

injectFieldback to summary
protected void injectField(Field field, Object injectable)

Inject value from jndi into a field of an instance

Parameters
field:Field

the field to inject into

injectable:Object

the value to inject

injectMethodback to summary
protected void injectMethod(Method method, Object injectable)

Inject value from jndi into a setter method of an instance

Parameters
method:Method

the method to inject into

injectable:Object

the value to inject

isFieldback to summary
public boolean isField()
isMethodback to summary
public boolean isMethod()
lookupInjectedValueback to summary
public Object lookupInjectedValue() throws NamingException

The Resource must already exist in the ENC of this webapp.

Returns:Object

the injected valud

Exceptions
NamingException:
if unable to lookup value