Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.laughingpanda.beaninject.impl;
 
 
 public class AnnotatedFieldInjector extends AbstractObjectInjector {
 
     private final Class<? extends Annotationannotation;
 
    public AnnotatedFieldInjector(Object target,
            Class<? extends Annotationannotation) {
        super(targetnull);
        this. = annotation;
    }
    public void with(Object dependency) {
        inject(dependency, Accessor.annotatedField(
                .getClass()));
    }
    private void inject(Object dependencyField field) {
        try {
            if (!field.isAccessible()) {
                field.setAccessible(true);
            }
            field.set(dependency);
        } catch (Exception e) {
            throw new RuntimeException("Failure to inject to field "
                    + field.getName(), e);
        }
    }
New to GrepCode? Check out our FAQ X