本文整理汇总了Java中javax.management.MBeanOperationInfo.getReturnType方法的典型用法代码示例。如果您正苦于以下问题:Java MBeanOperationInfo.getReturnType方法的具体用法?Java MBeanOperationInfo.getReturnType怎么用?Java MBeanOperationInfo.getReturnType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.management.MBeanOperationInfo
的用法示例。
在下文中一共展示了MBeanOperationInfo.getReturnType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import javax.management.MBeanOperationInfo; //导入方法依赖的package包/类
private static void test(Object child, String name, boolean mxbean)
throws Exception {
final ObjectName childName =
new ObjectName("test:type=Child,name="+name);
final MBeanServer server =
ManagementFactory.getPlatformMBeanServer();
server.registerMBean(child,childName);
try {
final MBeanInfo info = server.getMBeanInfo(childName);
System.out.println(name+": " + info.getDescriptor());
final int len = info.getOperations().length;
if (len == OPCOUNT) {
System.out.println(name+": OK, only "+OPCOUNT+
" operations here...");
} else {
final String qual = (len>OPCOUNT)?"many":"few";
System.err.println(name+": Too "+qual+" foos! Found "+
len+", expected "+OPCOUNT);
for (MBeanOperationInfo op : info.getOperations()) {
System.err.println("public "+op.getReturnType()+" "+
op.getName()+"();");
}
throw new RuntimeException("Too " + qual +
" foos for "+name);
}
final Descriptor d = info.getDescriptor();
final String mxstr = String.valueOf(d.getFieldValue("mxbean"));
final boolean mxb =
(mxstr==null)?false:Boolean.valueOf(mxstr).booleanValue();
System.out.println(name+": mxbean="+mxb);
if (mxbean && !mxb)
throw new AssertionError("MXBean is not OpenMBean?");
for (MBeanOperationInfo mboi : info.getOperations()) {
// Sanity check
if (mxbean && !mboi.getName().equals("foo")) {
// The spec doesn't guarantee that the MBeanOperationInfo
// of an MXBean will be an OpenMBeanOperationInfo, and in
// some circumstances in our implementation it will not.
// However, in thsi tests, for all methods but foo(),
// it should.
//
if (!(mboi instanceof OpenMBeanOperationInfo))
throw new AssertionError("Operation "+mboi.getName()+
"() is not Open?");
}
final String exp = EXPECTED_TYPES.get(mboi.getName());
// For MXBeans, we need to compare 'exp' with the original
// type - because mboi.getReturnType() returns the OpenType
//
String type = (String)mboi.getDescriptor().
getFieldValue("originalType");
if (type == null) type = mboi.getReturnType();
if (type.equals(exp)) continue;
System.err.println("Bad return type for "+
mboi.getName()+"! Found "+type+
", expected "+exp);
throw new RuntimeException("Bad return type for "+
mboi.getName());
}
} finally {
server.unregisterMBean(childName);
}
}
示例2: getColumnText
import javax.management.MBeanOperationInfo; //导入方法依赖的package包/类
@Override
public String getColumnText(Object element, int columnIndex) {
// 0:Name | 1:Return Type | 2:Impact | 3:Description
MBeanOperationModel model = (MBeanOperationModel) element;
MBeanOperation mbeanOperation = model.getData();
MBeanOperationInfo info = mbeanOperation.getInfo();
switch (columnIndex) {
case 0:
return mbeanOperation.getName();
case 1:
return info.getReturnType();
case 2:
return MBeanOperationDoc.getImpactString(info.getImpact());
case 3:
return info.getDescription();
}
return null;
}