本文整理汇总了Java中java.beans.ParameterDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java ParameterDescriptor类的具体用法?Java ParameterDescriptor怎么用?Java ParameterDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParameterDescriptor类属于java.beans包,在下文中一共展示了ParameterDescriptor类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _createMergedMethodDescriptor
import java.beans.ParameterDescriptor; //导入依赖的package包/类
private static MethodDescriptor _createMergedMethodDescriptor(
MethodDescriptor secondaryDescriptor,
MethodDescriptor primaryDescriptor
)
{
ParameterDescriptor[] parameterDescriptors =
primaryDescriptor.getParameterDescriptors();
if (parameterDescriptors == null)
{
parameterDescriptors = secondaryDescriptor.getParameterDescriptors();
}
MethodDescriptor mergedDescriptor = new MethodDescriptor(
primaryDescriptor.getMethod(),
parameterDescriptors);
// merge the superclasses
_mergeFeatureDescriptors(secondaryDescriptor,
primaryDescriptor,
mergedDescriptor);
return mergedDescriptor;
}
示例2: testMethodDescriptorMethodParameterDescriptorArray
import java.beans.ParameterDescriptor; //导入依赖的package包/类
public void testMethodDescriptorMethodParameterDescriptorArray()
throws SecurityException, NoSuchMethodException {
String beanName = "MethodDescriptorTest.bean";
MockJavaBean bean = new MockJavaBean(beanName);
Method method = bean.getClass().getMethod("setPropertyOne",
new Class[] { String.class });
ParameterDescriptor[] pds = new ParameterDescriptor[1];
pds[0] = new ParameterDescriptor();
pds[0].setValue(method.getName(), method.getReturnType());
MethodDescriptor md = new MethodDescriptor(method, pds);
assertSame(method, md.getMethod());
assertSame(pds, md.getParameterDescriptors());
assertEquals(pds[0].getValue(method.getName()), md
.getParameterDescriptors()[0].getValue(method.getName()));
assertEquals(method.getName(), md.getDisplayName());
assertEquals(method.getName(), md.getName());
assertEquals(method.getName(), md.getShortDescription());
assertNotNull(md.attributeNames());
assertFalse(md.isExpert());
assertFalse(md.isHidden());
assertFalse(md.isPreferred());
}
示例3: testMethodDescriptor
import java.beans.ParameterDescriptor; //导入依赖的package包/类
private static void testMethodDescriptor() {
try {
ParameterDescriptor[] array = { new ParameterDescriptor() };
MethodDescriptor descriptor = new MethodDescriptor(MyDPD.class.getMethod("getArray"), array);
test(descriptor.getParameterDescriptors());
array[0] = null;
test(descriptor.getParameterDescriptors());
descriptor.getParameterDescriptors()[0] = null;
test(descriptor.getParameterDescriptors());
}
catch (Exception exception) {
throw new Error("unexpected error", exception);
}
}
示例4: print
import java.beans.ParameterDescriptor; //导入依赖的package包/类
private static void print(MethodDescriptor[] mds) {
System.out.println(mds.length + " method descriptors");
Arrays.sort(mds, new Test4058433());
for (MethodDescriptor md : mds) {
print(md);
print("method", md.getMethod());
ParameterDescriptor[] pds = md.getParameterDescriptors();
if (pds != null) {
System.out.println(pds.length + " parameter descriptors");
for (ParameterDescriptor pd : pds) {
print(pd);
}
}
}
}
示例5: testMethodDescriptorMethodParameterDescriptorArray_MethodNull
import java.beans.ParameterDescriptor; //导入依赖的package包/类
public void testMethodDescriptorMethodParameterDescriptorArray_MethodNull() {
Method method = null;
ParameterDescriptor[] pds = new ParameterDescriptor[1];
pds[0] = new ParameterDescriptor();
try {
new MethodDescriptor(method, pds);
fail("Should throw NullPointerException.");
} catch (NullPointerException e) {
}
}
示例6: test_Ctor2_NullPointerException
import java.beans.ParameterDescriptor; //导入依赖的package包/类
/**
* @tests java.beans.MethodDescriptor#MethodDescriptor(
* java.lang.reflect.Method, java.beans.ParameterDescriptor[])
*/
public void test_Ctor2_NullPointerException() {
try {
// Regression for HARMONY-226
new MethodDescriptor(null, new ParameterDescriptor[0]);
fail("No expected NullPointerException");
} catch (NullPointerException e) {
}
}
示例7: testParameterDescriptor
import java.beans.ParameterDescriptor; //导入依赖的package包/类
public void testParameterDescriptor() {
ParameterDescriptor pd = new ParameterDescriptor();
assertNull(pd.getDisplayName());
assertNull(pd.getName());
assertNull(pd.getShortDescription());
assertNotNull(pd.attributeNames());
assertFalse(pd.isExpert());
assertFalse(pd.isHidden());
assertFalse(pd.isPreferred());
}