本文整理汇总了Java中java.beans.PropertyDescriptor.getPropertyEditorClass方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyDescriptor.getPropertyEditorClass方法的具体用法?Java PropertyDescriptor.getPropertyEditorClass怎么用?Java PropertyDescriptor.getPropertyEditorClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.PropertyDescriptor
的用法示例。
在下文中一共展示了PropertyDescriptor.getPropertyEditorClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: _mergePropertyDescriptors
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
/**
* Merge information from two PropertyDescriptors into a third
* PropertyDescriptor.
* In the event of other conflicts, the second argument
* <code>primaryDescriptor</code> is given priority over the first argument
* <code>secondaryDescriptor</code>.
* <p>
* @param secondaryDescriptor The lower priority PropertyDescriptor
* @param primaryDescriptor The higher priority PropertyDescriptor
* @param mergedDescriptor The PropertyDescriptor to merge the information
* into.
*/
private static void _mergePropertyDescriptors(
PropertyDescriptor secondaryDescriptor,
PropertyDescriptor primaryDescriptor,
PropertyDescriptor mergedDescriptor
)
{
// merge the superclasses
_mergeFeatureDescriptors(secondaryDescriptor,
primaryDescriptor,
mergedDescriptor);
//
// merge the property editor class
//
Class<?> editorClass = primaryDescriptor.getPropertyEditorClass();
// Give priority to the primary propertyEditor.
if (editorClass == null)
{
editorClass = secondaryDescriptor.getPropertyEditorClass();
}
mergedDescriptor.setPropertyEditorClass(editorClass);
// merge the bound property
mergedDescriptor.setBound(secondaryDescriptor.isBound() |
primaryDescriptor.isBound());
// merge the constrained property
mergedDescriptor.setConstrained(secondaryDescriptor.isConstrained() |
primaryDescriptor.isConstrained());
}
示例3: buildGenericTypeAwarePropertyDescriptor
import java.beans.PropertyDescriptor; //导入方法依赖的package包/类
private PropertyDescriptor buildGenericTypeAwarePropertyDescriptor(Class<?> beanClass, PropertyDescriptor pd) {
try {
return new GenericTypeAwarePropertyDescriptor(beanClass, pd.getName(), pd.getReadMethod(),
pd.getWriteMethod(), pd.getPropertyEditorClass());
}
catch (IntrospectionException ex) {
throw new FatalBeanException("Failed to re-introspect class [" + beanClass.getName() + "]", ex);
}
}
示例4: 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;
}