Duplicate :
|
|
Relates :
|
|
Relates :
|
Please run: import java.beans.BeanInfo; import java.beans.BeanProperty; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.util.Iterator; public class Test { public class C { private int value; @BeanProperty( bound = true, expert = true, hidden = true, preferred = true, required = true, visualUpdate = true, description = "OTHER", enumerationValues = {"javax.swing.SwingConstants.EAST"} ) public void setValue(int v) { value = v; } public int getValue() { return value; } } public static void main(String[] args) throws IntrospectionException { BeanInfo i = Introspector.getBeanInfo(C.class, Object.class); PropertyDescriptor d = i.getPropertyDescriptors()[0]; Iterator<String> it = d.attributeNames().asIterator(); while (it.hasNext()) { String key = it.next(); System.out.println(key + ": " + d.getValue(key)); } System.out.println("---"); System.out.println(d.isExpert()); System.out.println(d.isHidden()); } } Output (JDK9 b72, Win 7): expert: true visualUpdate: true hidden: true enumerationValues: [Ljava.lang.Object;@3ada9e37 --- true true So: 1. the "required" info is lost (we do not have d.isRequired() and d.getValue("required") is obviously null) 2. the "expert" and "hidden" info is duplicated
|