{
Injector jndiInjector;
if(annotatedElement instanceof Method)
{
BeanProperty prop = BeanPropertyFactory.create((Method) annotatedElement);
jndiInjector = new JndiPropertyInjector(prop, encName, container.getEnc());
}
else if(annotatedElement instanceof Field)
{
BeanProperty prop = BeanPropertyFactory.create((Field) annotatedElement);
jndiInjector = new JndiPropertyInjector(prop, encName, container.getEnc());
}
else
{
throw new IllegalStateException("Annotated element for '" + encName + "' is niether Method nor Field: " + annotatedElement);