Other |
---|
tbdUnresolved |
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
Please run: import java.beans.*; public class Test { public static class C { private int x; @BeanProperty( hidden = true, preferred = true, description = "xxx" ) public void setX(int i) { x = i; } public double getX() { return x; } } public static void main(String[] args) throws Exception { BeanInfo i = Introspector.getBeanInfo(C.class, Object.class); PropertyDescriptor d = i.getPropertyDescriptors()[0]; System.out.println(d.getShortDescription()); System.out.println(d.isHidden()); System.out.println(d.isPreferred()); } } note: here getX() returns double instead of int. Output (JDK9 b73, linux-64): x false false - just default values. If change "double getX()" to "int getX()" then the output will be as expected: xxx true true
|