1 23 24 package com.sun.enterprise.deployment; 25 26 import java.lang.reflect.Field ; 27 import java.lang.reflect.Method ; 28 import com.sun.enterprise.util.TypeUtil; 29 30 36 public class InjectionTarget { 37 38 private String className=null; 39 private String targetName=null; 40 private String fieldName=null; 41 private String methodName=null; 42 43 private Field field=null; 45 private Method method=null; 46 47 public boolean isFieldInjectable() { 48 return fieldName!=null; 49 } 50 51 public boolean isMethodInjectable() { 52 return methodName!=null; 53 } 54 55 public String getClassName() { 56 return className; 57 } 58 59 public void setClassName(String className) { 60 this.className = className; 61 } 62 63 71 72 public String getTargetName() { 73 return targetName; 74 } 75 76 public void setTargetName(String targetName) { 77 this.targetName = targetName; 78 } 79 80 public String getFieldName() { 81 return fieldName; 82 } 83 84 public void setFieldName(String fieldName) { 85 this.fieldName = fieldName; 86 this.targetName = fieldName; 87 } 88 89 92 public Field getField() { 93 return field; 94 } 95 public void setField(Field field) { 96 this.field = field; 97 } 98 99 104 public String getMethodName() { 105 return methodName; 106 } 107 public void setMethodName(String methodName) { 108 this.methodName = methodName; 109 this.targetName = TypeUtil.setterMethodToPropertyName(methodName); 111 ; 112 } 113 114 public Method getMethod() { 116 return method; 117 } 118 public void setMethod(Method method) { 119 this.method = method; 120 } 121 122 public boolean equals(Object o) { 123 if (!(o instanceof InjectionTarget)) { 124 return false; 125 } else { 126 InjectionTarget injTarget = (InjectionTarget)o; 127 return equals(className, injTarget.className) && 128 equals(targetName, injTarget.targetName) && 129 equals(fieldName, injTarget.fieldName) && 130 equals(methodName, injTarget.methodName); 131 } 132 } 133 134 private boolean equals(String s1, String s2) { 135 return (s1 != null && s1.equals(s2) || s1 == null && s2 == null); 136 } 137 } 138 | Popular Tags |