133 * introspection.
134 */
135 public PropertyDescriptor(String propertyName, Method readMethod, Method writeMethod)
136 throws IntrospectionException {
137 if (propertyName == null || propertyName.length() == 0) {
138 throw new IntrospectionException("bad property name");
139 }
140 setName(propertyName);
141 setReadMethod(readMethod);
142 setWriteMethod(writeMethod);
143 }
144
145 /**
146 * Creates {@code PropertyDescriptor} from the specified property info.
147 *
148 * @param entry the pair of values,
149 * where the {@code key} is the base name of the property (the rest of the method name)
150 * and the {@code value} is the automatically generated property info
151 * @param bound the flag indicating whether it is possible to treat this property as a bound property
152 *
153 * @since 1.9
154 */
155 PropertyDescriptor(Entry<String,PropertyInfo> entry, boolean bound) {
156 String base = entry.getKey();
157 PropertyInfo info = entry.getValue();
158 setName(Introspector.decapitalize(base));
159 setReadMethod0(info.getReadMethod());
160 setWriteMethod0(info.getWriteMethod());
161 setPropertyType(info.getPropertyType());
162 setConstrained(info.isConstrained());
163 setBound(bound && info.is(PropertyInfo.Name.bound));
164
165 boolean isExpert = info.is(PropertyInfo.Name.expert);
166 setValue(PropertyInfo.Name.expert.name(), isExpert); // compatibility
167 setExpert(isExpert);
168
169 boolean isHidden = info.is(PropertyInfo.Name.hidden);
170 setValue(PropertyInfo.Name.hidden.name(), isHidden); // compatibility
171 setHidden(isHidden);
172
173 setPreferred(info.is(PropertyInfo.Name.preferred));
|
133 * introspection.
134 */
135 public PropertyDescriptor(String propertyName, Method readMethod, Method writeMethod)
136 throws IntrospectionException {
137 if (propertyName == null || propertyName.length() == 0) {
138 throw new IntrospectionException("bad property name");
139 }
140 setName(propertyName);
141 setReadMethod(readMethod);
142 setWriteMethod(writeMethod);
143 }
144
145 /**
146 * Creates {@code PropertyDescriptor} from the specified property info.
147 *
148 * @param entry the pair of values,
149 * where the {@code key} is the base name of the property (the rest of the method name)
150 * and the {@code value} is the automatically generated property info
151 * @param bound the flag indicating whether it is possible to treat this property as a bound property
152 *
153 * @since 9
154 */
155 PropertyDescriptor(Entry<String,PropertyInfo> entry, boolean bound) {
156 String base = entry.getKey();
157 PropertyInfo info = entry.getValue();
158 setName(Introspector.decapitalize(base));
159 setReadMethod0(info.getReadMethod());
160 setWriteMethod0(info.getWriteMethod());
161 setPropertyType(info.getPropertyType());
162 setConstrained(info.isConstrained());
163 setBound(bound && info.is(PropertyInfo.Name.bound));
164
165 boolean isExpert = info.is(PropertyInfo.Name.expert);
166 setValue(PropertyInfo.Name.expert.name(), isExpert); // compatibility
167 setExpert(isExpert);
168
169 boolean isHidden = info.is(PropertyInfo.Name.hidden);
170 setValue(PropertyInfo.Name.hidden.name(), isHidden); // compatibility
171 setHidden(isHidden);
172
173 setPreferred(info.is(PropertyInfo.Name.preferred));
|