FileDocCategorySizeDatePackage
InjectionTarget.javaAPI DocGlassfish v2 API5619Fri May 04 22:31:22 BST 2007com.sun.enterprise.deployment

InjectionTarget

public class InjectionTarget extends Object implements Serializable
This class holds information about an injection target like the class name of the injected target, and field/method information used for injection.
author
Jerome Dochez

Fields Summary
private String
className
private String
targetName
private String
fieldName
private String
methodName
private transient Field
field
private transient Method
method
Constructors Summary
Methods Summary
public booleanequals(java.lang.Object o)

        if (!(o instanceof InjectionTarget)) {
            return false;
        } else {
            InjectionTarget injTarget = (InjectionTarget)o;
            return equals(className, injTarget.className) &&
                   equals(targetName, injTarget.targetName) &&
                   equals(fieldName, injTarget.fieldName) &&
                   equals(methodName, injTarget.methodName);
        }
    
private booleanequals(java.lang.String s1, java.lang.String s2)

        return (s1 != null && s1.equals(s2) || s1 == null && s2 == null);
    
public java.lang.StringgetClassName()

        return className;
    
public java.lang.reflect.FieldgetField()

        return field;
    
public java.lang.StringgetFieldName()

        return fieldName;
    
public java.lang.reflect.MethodgetMethod()

        return method;
    
public java.lang.StringgetMethodName()
Inject method name is the actual java method name of the setter method, not the bean property name. E.g., for @Resource void setFoo(Bar b) it would be "setFoo", not the property name "foo".

        return methodName;
    
public java.lang.StringgetTargetName()
This is the form used by the .xml injection-group elements to represent the target of injection. It either represents the javabeans property name of the injection method or the name of the injected field. This value is set on the descriptor during .xml processing and converted into the appropriate field/method name during validation.

        return targetName;
    
public inthashCode()

        int result = 17;
        result = 37*result + (className == null ? 0 : className.hashCode());
        result = 37*result + (targetName == null ? 0: targetName.hashCode());
        result = 37*result + (fieldName == null ? 0: fieldName.hashCode());
        result = 37*result + (methodName == null ? 0: methodName.hashCode());
        return result;
    
public booleanisFieldInjectable()

    
       
        return fieldName!=null;
    
public booleanisMethodInjectable()

        return methodName!=null;
    
public voidsetClassName(java.lang.String className)

        this.className = className;
    
public voidsetField(java.lang.reflect.Field field)

        this.field = field;
    
public voidsetFieldName(java.lang.String fieldName)

        this.fieldName = fieldName;
        this.targetName = fieldName;
    
public voidsetMethod(java.lang.reflect.Method method)

        this.method = method;
    
public voidsetMethodName(java.lang.String methodName)

        this.methodName = methodName;
        // Method name follows java beans setter syntax
        this.targetName = TypeUtil.setterMethodToPropertyName(methodName);
;
    
public voidsetTargetName(java.lang.String targetName)

        this.targetName = targetName;