本文整理匯總了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;
}