本文整理汇总了Java中javax.management.openmbean.SimpleType.BOOLEAN属性的典型用法代码示例。如果您正苦于以下问题:Java SimpleType.BOOLEAN属性的具体用法?Java SimpleType.BOOLEAN怎么用?Java SimpleType.BOOLEAN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.management.openmbean.SimpleType
的用法示例。
在下文中一共展示了SimpleType.BOOLEAN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJmxType
private OpenType<?> getJmxType(Class<?> type) {
if (type == Boolean.class) {
return SimpleType.BOOLEAN;
} else if (type == Integer.class || type == AtomicInteger.class) {
return SimpleType.INTEGER;
} else if (type == Long.class || type == AtomicLong.class) {
return SimpleType.LONG;
} else if (type == Double.class) {
return SimpleType.DOUBLE;
} else if (type == String.class) {
return SimpleType.STRING;
} else {
throw new UnsupportedOperationException(
"Don't know how to process Monitorable of type [" + type + "]");
}
}
示例2: simpleTypeOf
private static SimpleType<?> simpleTypeOf(Class<?> clazz) throws IllegalArgumentException {
if (clazz == boolean.class || clazz == Boolean.class) {
return SimpleType.BOOLEAN;
} else if (clazz == byte.class || clazz == Byte.class) {
return SimpleType.BYTE;
} else if (clazz == short.class || clazz == Short.class) {
return SimpleType.SHORT;
} else if (clazz == char.class || clazz == Character.class) {
return SimpleType.CHARACTER;
} else if (clazz == int.class || clazz == Integer.class) {
return SimpleType.INTEGER;
} else if (clazz == long.class || clazz == Long.class) {
return SimpleType.LONG;
} else if (clazz == float.class || clazz == Float.class) {
return SimpleType.FLOAT;
} else if (clazz == double.class || clazz == Double.class) {
return SimpleType.DOUBLE;
} else if (clazz == String.class) {
return SimpleType.STRING;
} else {
throw new IllegalArgumentException("There is no SimpleType for " + clazz.getName());
}
}
示例3: getStackTraceElementCompositeType
/**
* @return an instance of {@link CompositeType}for the
* {@link StackTraceElement}class.
*/
private static CompositeType getStackTraceElementCompositeType() {
if (STACKTRACEELEMENT_COMPOSITETYPE == null) {
String[] typeNames = { "className", "methodName", "fileName",
"lineNumber", "nativeMethod" };
String[] typeDescs = { "className", "methodName", "fileName",
"lineNumber", "nativeMethod" };
OpenType[] typeTypes = { SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.INTEGER, SimpleType.BOOLEAN };
try {
STACKTRACEELEMENT_COMPOSITETYPE = new CompositeType(
StackTraceElement.class.getName(),
StackTraceElement.class.getName(), typeNames,
typeDescs, typeTypes);
} catch (OpenDataException e) {
if (ManagementUtils.VERBOSE_MODE) {
e.printStackTrace(System.err);
}// end if
}
}
return STACKTRACEELEMENT_COMPOSITETYPE;
}
示例4: test_from_scenario2
public void test_from_scenario2() throws Exception {
initialValues[0] = "1";
ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
OpenType[] types = { SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
SimpleType.STRING, stackTraceArray, SimpleType.STRING };
CompositeType compositeType = getCompositeType(initialNames, types);
CompositeData data = new CompositeDataSupport(compositeType,
initialNames, initialValues);
try {
ThreadInfo.from(data);
fail("should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
// Expected
}
}
示例5: test_from_scenario4
public void test_from_scenario4() throws Exception {
initialValues[0] = null;
ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
SimpleType.STRING, stackTraceArray, SimpleType.STRING };
CompositeType compositeType = getCompositeType(initialNames, types);
CompositeData data = new CompositeDataSupport(compositeType,
initialNames, initialValues);
try {
ThreadInfo.from(data);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// Expected
}
}
示例6: test_from_scenario5
public void test_from_scenario5() throws Exception {
initialValues[1] = null;
ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
SimpleType.STRING, stackTraceArray, SimpleType.STRING };
CompositeType compositeType = getCompositeType(initialNames, types);
CompositeData data = new CompositeDataSupport(compositeType,
initialNames, initialValues);
try {
ThreadInfo.from(data);
fail("should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
// Expected
}
}
示例7: test_from_scenario6
public void test_from_scenario6() throws Exception {
initialValues[2] = null;
ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
SimpleType.STRING, stackTraceArray, SimpleType.STRING };
CompositeType compositeType = getCompositeType(initialNames, types);
CompositeData data = new CompositeDataSupport(compositeType,
initialNames, initialValues);
try {
ThreadInfo.from(data);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// Expected
}
}
示例8: test_from_scenario7
public void test_from_scenario7() throws Exception {
initialValues[3] = null;
ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
SimpleType.STRING, stackTraceArray, SimpleType.STRING };
CompositeType compositeType = getCompositeType(initialNames, types);
CompositeData data = new CompositeDataSupport(compositeType,
initialNames, initialValues);
try {
ThreadInfo.from(data);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// Expected
}
}
示例9: test_from_scenario8
public void test_from_scenario8() throws Exception {
initialValues[4] = null;
ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
SimpleType.STRING, stackTraceArray, SimpleType.STRING };
CompositeType compositeType = getCompositeType(initialNames, types);
CompositeData data = new CompositeDataSupport(compositeType,
initialNames, initialValues);
try {
ThreadInfo.from(data);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// Expected
}
}
示例10: test_from_scenario9
public void test_from_scenario9() throws Exception {
initialValues[5] = null;
ArrayType stackTraceArray = new ArrayType(1, stackTraceElementType);
OpenType[] types = { SimpleType.LONG, SimpleType.STRING,
SimpleType.STRING, SimpleType.BOOLEAN, SimpleType.BOOLEAN,
SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
SimpleType.STRING, stackTraceArray, SimpleType.STRING };
CompositeType compositeType = getCompositeType(initialNames, types);
CompositeData data = new CompositeDataSupport(compositeType,
initialNames, initialValues);
try {
ThreadInfo.from(data);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// Expected
}
}
示例11: init
/**
* initialises the openmbean data types
*/
private static void init() throws OpenDataException
{
_msgContentAttributeTypes[0] = SimpleType.LONG; // For message id
_msgContentAttributeTypes[1] = SimpleType.STRING; // For MimeType
_msgContentAttributeTypes[2] = SimpleType.STRING; // For Encoding
_msgContentAttributeTypes[3] = new ArrayType(1, SimpleType.BYTE); // For message content
_msgContentType = new CompositeType("Message Content", "AMQ Message Content",
VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.toArray(new String[VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.size()]),
VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.toArray(new String[VIEW_MSG_CONTENT_COMPOSITE_ITEM_NAMES_DESC.size()]),
_msgContentAttributeTypes);
_msgAttributeTypes[0] = SimpleType.LONG; // For message id
_msgAttributeTypes[1] = new ArrayType(1, SimpleType.STRING); // For header attributes
_msgAttributeTypes[2] = SimpleType.LONG; // For size
_msgAttributeTypes[3] = SimpleType.BOOLEAN; // For redelivered
_msgAttributeTypes[4] = SimpleType.LONG; // For queue position
_messageDataType = new CompositeType("Message", "AMQ Message",
VIEW_MSGS_COMPOSITE_ITEM_NAMES_DESC.toArray(new String[VIEW_MSGS_COMPOSITE_ITEM_NAMES_DESC.size()]),
VIEW_MSGS_COMPOSITE_ITEM_NAMES_DESC.toArray(new String[VIEW_MSGS_COMPOSITE_ITEM_NAMES_DESC.size()]), _msgAttributeTypes);
_messagelistDataType = new TabularType("Messages", "List of messages", _messageDataType,
VIEW_MSGS_TABULAR_UNIQUE_INDEX.toArray(new String[VIEW_MSGS_TABULAR_UNIQUE_INDEX.size()]));
}
示例12: getOpenType
public static OpenType<?> getOpenType(Object o)
{
if(o instanceof Long)
{
return SimpleType.LONG;
}
else if(o instanceof String)
{
return SimpleType.STRING;
}
else if(o instanceof Date)
{
return SimpleType.DATE;
}
else if(o instanceof Integer)
{
return SimpleType.INTEGER;
}
else if(o instanceof Boolean)
{
return SimpleType.BOOLEAN;
}
else if(o instanceof Double)
{
return SimpleType.DOUBLE;
}
else if(o instanceof Float)
{
return SimpleType.FLOAT;
}
else
{
throw new IllegalArgumentException();
}
}
示例13: setup
@BeforeClass
public static void setup() throws Exception {
compositeTypeV6 = new CompositeType(
StackTraceElement.class.getName(),
"StackTraceElement",
new String[]{
"className", "methodName", "fileName", "nativeMethod", "lineNumber"
},
new String[]{
"className", "methodName", "fileName", "nativeMethod", "lineNumber"
},
new OpenType[]{
SimpleType.STRING,
SimpleType.STRING,
SimpleType.STRING,
SimpleType.BOOLEAN,
SimpleType.INTEGER
}
);
itemsV6 = new HashMap<>();
itemsV6.put("className", "MyClass");
itemsV6.put("methodName", "myMethod");
itemsV6.put("fileName", "MyClass.java");
itemsV6.put("nativeMethod", false);
itemsV6.put("lineNumber", 123);
compositeDataV6 = new CompositeDataSupport(compositeTypeV6, itemsV6);
}
示例14: getStackTraceType
/**
* Returns the {@link javax.management.openmbean.CompositeType} for
* a {@link StackTraceElement}.
*
* @return the type for the stack trace element.
*/
static CompositeType getStackTraceType()
{
if (seType == null)
try
{
seType = new CompositeType(StackTraceElement.class.getName(),
"An element of a stack trace",
new String[] { "className", "methodName",
"fileName", "lineNumber",
"nativeMethod"
},
new String[] { "Name of the class",
"Name of the method",
"Name of the source code file",
"Line number",
"True if this is a native method"
},
new OpenType[] {
SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.INTEGER,
SimpleType.BOOLEAN
});
}
catch (OpenDataException e)
{
throw new IllegalStateException("Something went wrong in creating " +
"the composite data type for the " +
"stack trace element.", e);
}
return seType;
}
示例15: getStackTraceType
/**
* Returns the {@link javax.management.openmbean.CompositeType} for
* a {@link StackTraceElement}.
*
* @return the type for the stack trace element.
*/
static CompositeType getStackTraceType()
{
if (seType == null)
try
{
seType = new CompositeType(StackTraceElement.class.getName(),
"An element of a stack trace",
new String[] { "className", "methodName",
"fileName", "lineNumber",
"nativeMethod"
},
new String[] { "Name of the class",
"Name of the method",
"Name of the source code file",
"Line number",
"True if this is a native method"
},
new OpenType[] {
SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.INTEGER,
SimpleType.BOOLEAN
});
}
catch (OpenDataException e)
{
throw new IllegalStateException("Something went wrong in creating " +
"the composite data type for the " +
"stack trace element.", e);
}
return seType;
}