Code example for Field

Methods: getName, isAccessible, setAccessible

0
    public void injectField (Field field, Object injectable)
    {            
        try 
        { 
            //validateInjection(field, injectable); 
            boolean accessibility = field.isAccessible();
            field.setAccessible(true);
            field.set(injectable, lookupInjectedValue());
            field.setAccessible(accessibility);
        } 
        catch (Exception e)
        { 
            Log.warn(e);
            throw new IllegalStateException("Inject failed for field "+field.getName());
        } 
    } 
     
    /** 
     * Inject value from jndi into a setter method of an instance 
     * @param method 
     * @param injectable