本文整理汇总了Java中java.beans.PropertyDescriptor.isConstrained方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyDescriptor.isConstrained方法的具体用法?Java PropertyDescriptor.isConstrained怎么用?Java PropertyDescriptor.isConstrained使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.PropertyDescriptor
的用法示例。
在下文中一共展示了PropertyDescriptor.isConstrained方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: equals
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
/**
* Compare the given {@link PropertyDescriptor} against the given {@link Object} and
* return {@code true} if they are objects are equivalent, i.e. both are {@code
* PropertyDescriptor}s whose read method, write method, property types, property
* editor and flags are equivalent.
* @see PropertyDescriptor#equals(Object)
*/
public static boolean equals(PropertyDescriptor pd1, Object obj) {
if (pd1 == obj) {
return true;
}
if (obj != null && obj instanceof PropertyDescriptor) {
PropertyDescriptor pd2 = (PropertyDescriptor) obj;
if (!compareMethods(pd1.getReadMethod(), pd2.getReadMethod())) {
return false;
}
if (!compareMethods(pd1.getWriteMethod(), pd2.getWriteMethod())) {
return false;
}
if (pd1.getPropertyType() == pd2.getPropertyType() &&
pd1.getPropertyEditorClass() == pd2.getPropertyEditorClass() &&
pd1.isBound() == pd2.isBound() && pd1.isConstrained() == pd2.isConstrained()) {
return true;
}
}
return false;
}
示例2: compare
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
private static boolean compare(PropertyDescriptor pd1, PropertyDescriptor pd2) {
if (!compare(pd1.getReadMethod(), pd2.getReadMethod())) {
System.out.println("read methods not equal");
return false;
}
if (!compare(pd1.getWriteMethod(), pd2.getWriteMethod())) {
System.out.println("write methods not equal");
return false;
}
if (pd1.getPropertyType() != pd2.getPropertyType()) {
System.out.println("property type not equal");
return false;
}
if (pd1.getPropertyEditorClass() != pd2.getPropertyEditorClass()) {
System.out.println("property editor class not equal");
return false;
}
if (pd1.isBound() != pd2.isBound()) {
System.out.println("bound value not equal");
return false;
}
if (pd1.isConstrained() != pd2.isConstrained()) {
System.out.println("constrained value not equal");
return false;
}
return true;
}