1 22 package org.jboss.beans.info.plugins; 23 24 import org.jboss.beans.info.spi.BeanInfo; 25 import org.jboss.beans.info.spi.PropertyInfo; 26 import org.jboss.reflect.spi.MethodInfo; 27 import org.jboss.reflect.spi.TypeInfo; 28 import org.jboss.util.JBossObject; 29 import org.jboss.util.JBossStringBuilder; 30 31 37 public class AbstractPropertyInfo extends JBossObject implements PropertyInfo 38 { 39 40 protected BeanInfo beanInfo; 41 42 43 protected String name; 44 45 46 protected String upperName; 47 48 49 protected TypeInfo type; 50 51 52 protected MethodInfo getter; 53 54 55 protected MethodInfo setter; 56 57 60 public AbstractPropertyInfo() 61 { 62 this(null, null, null, null, null); 63 } 64 65 70 public AbstractPropertyInfo(String name) 71 { 72 this(name, name, null, null, null); 73 } 74 75 84 public AbstractPropertyInfo(String name, String upperName, TypeInfo type, MethodInfo getter, MethodInfo setter) 85 { 86 this.name = name; 87 this.upperName = upperName; 88 this.type = type; 89 this.getter = getter; 90 this.setter = setter; 91 } 92 93 public BeanInfo getBeanInfo() 94 { 95 return beanInfo; 96 } 97 98 public String getName() 99 { 100 return name; 101 } 102 103 public String getUpperName() 104 { 105 return upperName; 106 } 107 108 public TypeInfo getType() 109 { 110 return type; 111 } 112 113 public void setType(TypeInfo type) 114 { 115 this.type = type; 116 } 117 118 public MethodInfo getGetter() 119 { 120 return getter; 121 } 122 123 public void setGetter(MethodInfo getter) 124 { 125 this.getter = getter; 126 } 127 128 public MethodInfo getSetter() 129 { 130 return setter; 131 } 132 133 public void setSetter(MethodInfo setter) 134 { 135 this.setter = setter; 136 } 137 138 public boolean equals(Object object) 139 { 140 if (object == null || object instanceof AbstractPropertyInfo == false) 141 return false; 142 143 AbstractPropertyInfo other = (AbstractPropertyInfo) object; 144 if (notEqual(name, other.name)) 145 return false; 146 else if (notEqual(getter, other.getter)) 147 return false; 148 else if (notEqual(setter, other.setter)) 149 return false; 150 return true; 151 } 152 153 public void toString(JBossStringBuilder buffer) 154 { 155 buffer.append("name=").append(name); 156 buffer.append(" getter=").append(getter); 157 buffer.append(" setter=").append(setter); 158 } 159 160 public void toShortString(JBossStringBuilder buffer) 161 { 162 buffer.append(name); 163 } 164 165 public int getHashCode() 166 { 167 return name.hashCode(); 168 } 169 } 170 | Popular Tags |