108 return false; 109 } 110 initialize(this.write); 111 initialize(this.read); 112 return true; 113 } 114 115 private void initialize(MethodInfo info) { 116 if (info != null) { 117 BeanProperty annotation = info.method.getAnnotation(BeanProperty.class); 118 if (annotation != null) { 119 if (!annotation.bound()) { 120 put(Name.bound, Boolean.FALSE); 121 } 122 put(Name.expert, annotation.expert()); 123 put(Name.hidden, annotation.hidden()); 124 put(Name.preferred, annotation.preferred()); 125 put(Name.visualUpdate, annotation.visualUpdate()); 126 put(Name.description, annotation.description()); 127 String[] values = annotation.enumerationValues(); 128 if (0 < values.length) { 129 try { 130 Object[] array = new Object[3 * values.length]; 131 int index = 0; 132 for (String value : values) { 133 Class<?> type = info.method.getDeclaringClass(); 134 String name = value; 135 int pos = value.lastIndexOf('.'); 136 if (pos > 0) { 137 name = value.substring(0, pos); 138 if (name.indexOf('.') < 0) { 139 String pkg = type.getName(); 140 name = pkg.substring(0, 1 + Math.max( 141 pkg.lastIndexOf('.'), 142 pkg.lastIndexOf('$'))) + name; 143 } 144 type = findClass(name); 145 name = value.substring(pos + 1); 146 } 147 Field field = type.getField(name); 148 if (Modifier.isStatic(field.getModifiers()) && info.type.isAssignableFrom(field.getType())) { 149 array[index++] = name; 150 array[index++] = field.get(null); 151 array[index++] = value; 152 } 153 } 154 if (index == array.length) { 155 put(Name.enumerationValues, array); 156 } 157 } catch (Exception ignored) { 158 ignored.printStackTrace(); 159 } 160 } 161 } 162 } 163 } 164 165 public Class<?> getPropertyType() { 166 return this.type; 167 } 168 169 public Method getReadMethod() { 170 return (this.read == null) ? null : this.read.method; 171 } 172 173 public Method getWriteMethod() { 174 return (this.write == null) ? null : this.write.method; 175 } 176 177 public PropertyInfo getIndexed() { 178 return this.indexed; 179 } 180 181 public boolean isConstrained() { 182 if (this.write != null) { 183 if (VETO_EXCEPTION == null) { | 108 return false; 109 } 110 initialize(this.write); 111 initialize(this.read); 112 return true; 113 } 114 115 private void initialize(MethodInfo info) { 116 if (info != null) { 117 BeanProperty annotation = info.method.getAnnotation(BeanProperty.class); 118 if (annotation != null) { 119 if (!annotation.bound()) { 120 put(Name.bound, Boolean.FALSE); 121 } 122 put(Name.expert, annotation.expert()); 123 put(Name.hidden, annotation.hidden()); 124 put(Name.preferred, annotation.preferred()); 125 put(Name.visualUpdate, annotation.visualUpdate()); 126 put(Name.description, annotation.description()); 127 String[] values = annotation.enumerationValues(); 128 try { 129 Object[] array = new Object[3 * values.length]; 130 int index = 0; 131 for (String value : values) { 132 Class<?> type = info.method.getDeclaringClass(); 133 String name = value; 134 int pos = value.lastIndexOf('.'); 135 if (pos > 0) { 136 name = value.substring(0, pos); 137 if (name.indexOf('.') < 0) { 138 String pkg = type.getName(); 139 name = pkg.substring(0, 1 + Math.max( 140 pkg.lastIndexOf('.'), 141 pkg.lastIndexOf('$'))) + name; 142 } 143 type = findClass(name); 144 name = value.substring(pos + 1); 145 } 146 Field field = type.getField(name); 147 if (Modifier.isStatic(field.getModifiers()) && info.type.isAssignableFrom(field.getType())) { 148 array[index++] = name; 149 array[index++] = field.get(null); 150 array[index++] = value; 151 } 152 } 153 if (index == array.length) { 154 put(Name.enumerationValues, array); 155 } 156 } catch (Exception ignored) { 157 ignored.printStackTrace(); 158 } 159 } 160 } 161 } 162 163 public Class<?> getPropertyType() { 164 return this.type; 165 } 166 167 public Method getReadMethod() { 168 return (this.read == null) ? null : this.read.method; 169 } 170 171 public Method getWriteMethod() { 172 return (this.write == null) ? null : this.write.method; 173 } 174 175 public PropertyInfo getIndexed() { 176 return this.indexed; 177 } 178 179 public boolean isConstrained() { 180 if (this.write != null) { 181 if (VETO_EXCEPTION == null) { |