本文整理汇总了Java中javax.management.openmbean.SimpleType.FLOAT属性的典型用法代码示例。如果您正苦于以下问题:Java SimpleType.FLOAT属性的具体用法?Java SimpleType.FLOAT怎么用?Java SimpleType.FLOAT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.management.openmbean.SimpleType
的用法示例。
在下文中一共展示了SimpleType.FLOAT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
}
示例2: 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();
}
}
示例3: getTypeForName
private static SimpleType<?> getTypeForName(String name) {
switch (name) {
case "boolean":
case "java.lang.Boolean": return SimpleType.BOOLEAN;
case "byte":
case "java.lang.Byte": return SimpleType.BYTE;
case "char":
case "java.lang.Character": return SimpleType.CHARACTER;
case "double":
case "java.lang.Double": return SimpleType.DOUBLE;
case "float":
case "java.lang.Float": return SimpleType.FLOAT;
case "int":
case "java.lang.Integer": return SimpleType.INTEGER;
case "long":
case "java.lang.Long": return SimpleType.LONG;
case "short":
case "java.lang.Short": return SimpleType.SHORT;
case "java.math.BigDecimal": return SimpleType.BIGDECIMAL;
case "java.math.BigInteger": return SimpleType.BIGINTEGER;
case "java.util.Date": return SimpleType.DATE;
case "javax.management.ObjectName": return SimpleType.OBJECTNAME;
case "java.lang.String": return SimpleType.STRING;
//CompositeData.class.getName(),
//TabularData.class.getName()
//}
}
return null;
}
示例4: getGcInfoCompositeType
synchronized CompositeType getGcInfoCompositeType() {
if (gcInfoCompositeType != null)
return gcInfoCompositeType;
// First, fill with the attributes in the GcInfo
String[] gcInfoItemNames = GcInfoCompositeData.getBaseGcInfoItemNames();
OpenType<?>[] gcInfoItemTypes = GcInfoCompositeData.getBaseGcInfoItemTypes();
int numGcInfoItems = gcInfoItemNames.length;
int itemCount = numGcInfoItems + gcExtItemCount;
allItemNames = new String[itemCount];
String[] allItemDescs = new String[itemCount];
OpenType<?>[] allItemTypes = new OpenType<?>[itemCount];
System.arraycopy(gcInfoItemNames, 0, allItemNames, 0, numGcInfoItems);
System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems);
System.arraycopy(gcInfoItemTypes, 0, allItemTypes, 0, numGcInfoItems);
// Then fill with the extension GC-specific attributes, if any.
if (gcExtItemCount > 0) {
fillGcAttributeInfo(gc, gcExtItemCount, gcExtItemNames,
gcExtItemTypes, gcExtItemDescs);
System.arraycopy(gcExtItemNames, 0, allItemNames,
numGcInfoItems, gcExtItemCount);
System.arraycopy(gcExtItemDescs, 0, allItemDescs,
numGcInfoItems, gcExtItemCount);
for (int i = numGcInfoItems, j = 0; j < gcExtItemCount; i++, j++) {
switch (gcExtItemTypes[j]) {
case 'Z':
allItemTypes[i] = SimpleType.BOOLEAN;
break;
case 'B':
allItemTypes[i] = SimpleType.BYTE;
break;
case 'C':
allItemTypes[i] = SimpleType.CHARACTER;
break;
case 'S':
allItemTypes[i] = SimpleType.SHORT;
break;
case 'I':
allItemTypes[i] = SimpleType.INTEGER;
break;
case 'J':
allItemTypes[i] = SimpleType.LONG;
break;
case 'F':
allItemTypes[i] = SimpleType.FLOAT;
break;
case 'D':
allItemTypes[i] = SimpleType.DOUBLE;
break;
default:
throw new AssertionError(
"Unsupported type [" + gcExtItemTypes[i] + "]");
}
}
}
CompositeType gict = null;
try {
final String typeName =
"sun.management." + gc.getName() + ".GcInfoCompositeType";
gict = new CompositeType(typeName,
"CompositeType for GC info for " +
gc.getName(),
allItemNames,
allItemDescs,
allItemTypes);
} catch (OpenDataException e) {
// shouldn't reach here
throw new RuntimeException(e);
}
gcInfoCompositeType = gict;
return gcInfoCompositeType;
}
示例5: getGcInfoCompositeType
synchronized CompositeType getGcInfoCompositeType() {
if (gcInfoCompositeType != null)
return gcInfoCompositeType;
// First, fill with the attributes in the GcInfo
String[] gcInfoItemNames = GcInfoCompositeData.getBaseGcInfoItemNames();
OpenType[] gcInfoItemTypes = GcInfoCompositeData.getBaseGcInfoItemTypes();
int numGcInfoItems = gcInfoItemNames.length;
int itemCount = numGcInfoItems + gcExtItemCount;
allItemNames = new String[itemCount];
String[] allItemDescs = new String[itemCount];
OpenType<?>[] allItemTypes = new OpenType<?>[itemCount];
System.arraycopy(gcInfoItemNames, 0, allItemNames, 0, numGcInfoItems);
System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems);
System.arraycopy(gcInfoItemTypes, 0, allItemTypes, 0, numGcInfoItems);
// Then fill with the extension GC-specific attributes, if any.
if (gcExtItemCount > 0) {
fillGcAttributeInfo(gc, gcExtItemCount, gcExtItemNames,
gcExtItemTypes, gcExtItemDescs);
System.arraycopy(gcExtItemNames, 0, allItemNames,
numGcInfoItems, gcExtItemCount);
System.arraycopy(gcExtItemDescs, 0, allItemDescs,
numGcInfoItems, gcExtItemCount);
for (int i = numGcInfoItems, j = 0; j < gcExtItemCount; i++, j++) {
switch (gcExtItemTypes[j]) {
case 'Z':
allItemTypes[i] = SimpleType.BOOLEAN;
break;
case 'B':
allItemTypes[i] = SimpleType.BYTE;
break;
case 'C':
allItemTypes[i] = SimpleType.CHARACTER;
break;
case 'S':
allItemTypes[i] = SimpleType.SHORT;
break;
case 'I':
allItemTypes[i] = SimpleType.INTEGER;
break;
case 'J':
allItemTypes[i] = SimpleType.LONG;
break;
case 'F':
allItemTypes[i] = SimpleType.FLOAT;
break;
case 'D':
allItemTypes[i] = SimpleType.DOUBLE;
break;
default:
throw new AssertionError(
"Unsupported type [" + gcExtItemTypes[i] + "]");
}
}
}
CompositeType gict = null;
try {
final String typeName =
"sun.management." + gc.getName() + ".GcInfoCompositeType";
gict = new CompositeType(typeName,
"CompositeType for GC info for " +
gc.getName(),
allItemNames,
allItemDescs,
allItemTypes);
} catch (OpenDataException e) {
// shouldn't reach here
throw Util.newException(e);
}
gcInfoCompositeType = gict;
return gcInfoCompositeType;
}
示例6: getGcInfoCompositeType
synchronized CompositeType getGcInfoCompositeType() {
if (gcInfoCompositeType != null)
return gcInfoCompositeType;
// First, fill with the attributes in the GcInfo
String[] gcInfoItemNames = GcInfoCompositeData.getBaseGcInfoItemNames();
OpenType[] gcInfoItemTypes = GcInfoCompositeData.getBaseGcInfoItemTypes();
int numGcInfoItems = gcInfoItemNames.length;
int itemCount = numGcInfoItems + gcExtItemCount;
allItemNames = new String[itemCount];
String[] allItemDescs = new String[itemCount];
OpenType[] allItemTypes = new OpenType[itemCount];
System.arraycopy(gcInfoItemNames, 0, allItemNames, 0, numGcInfoItems);
System.arraycopy(gcInfoItemNames, 0, allItemDescs, 0, numGcInfoItems);
System.arraycopy(gcInfoItemTypes, 0, allItemTypes, 0, numGcInfoItems);
// Then fill with the extension GC-specific attributes, if any.
if (gcExtItemCount > 0) {
fillGcAttributeInfo(gc, gcExtItemCount, gcExtItemNames,
gcExtItemTypes, gcExtItemDescs);
System.arraycopy(gcExtItemNames, 0, allItemNames,
numGcInfoItems, gcExtItemCount);
System.arraycopy(gcExtItemDescs, 0, allItemDescs,
numGcInfoItems, gcExtItemCount);
for (int i = numGcInfoItems, j = 0; j < gcExtItemCount; i++, j++) {
switch (gcExtItemTypes[j]) {
case 'Z':
allItemTypes[i] = SimpleType.BOOLEAN;
break;
case 'B':
allItemTypes[i] = SimpleType.BYTE;
break;
case 'C':
allItemTypes[i] = SimpleType.CHARACTER;
break;
case 'S':
allItemTypes[i] = SimpleType.SHORT;
break;
case 'I':
allItemTypes[i] = SimpleType.INTEGER;
break;
case 'J':
allItemTypes[i] = SimpleType.LONG;
break;
case 'F':
allItemTypes[i] = SimpleType.FLOAT;
break;
case 'D':
allItemTypes[i] = SimpleType.DOUBLE;
break;
default:
throw new AssertionError(
"Unsupported type [" + gcExtItemTypes[i] + "]");
}
}
}
CompositeType gict = null;
try {
final String typeName =
"sun.management." + gc.getName() + ".GcInfoCompositeType";
gict = new CompositeType(typeName,
"CompositeType for GC info for " +
gc.getName(),
allItemNames,
allItemDescs,
allItemTypes);
} catch (OpenDataException e) {
// shouldn't reach here
throw Util.newException(e);
}
gcInfoCompositeType = gict;
return gcInfoCompositeType;
}
示例7: getOpenType
private static OpenType getOpenType(Object value) {
if (value == null) {
return SimpleType.VOID;
}
String name = value.getClass().getName();
//if (OpenType.ALLOWED_CLASSNAMES_LIST.contains(name)) {
if ("java.lang.Long".equals(name)) {
return SimpleType.LONG;
}
if ("java.lang.Integer".equals(name)) {
return SimpleType.INTEGER;
}
if ("java.lang.String".equals(name)) {
return SimpleType.STRING;
}
if ("java.lang.Double".equals(name)) {
return SimpleType.DOUBLE;
}
if ("java.lang.Float".equals(name)) {
return SimpleType.FLOAT;
}
if ("java.math.BigDecimal".equals(name)) {
return SimpleType.BIGDECIMAL;
}
if ("java.math.BigInteger".equals(name)) {
return SimpleType.BIGINTEGER;
}
if ("java.lang.Boolean".equals(name)) {
return SimpleType.BOOLEAN;
}
if ("java.lang.Byte".equals(name)) {
return SimpleType.BYTE;
}
if ("java.lang.Character".equals(name)) {
return SimpleType.CHARACTER;
}
if ("java.util.Date".equals(name)) {
return SimpleType.DATE;
}
if ("java.lang.Short".equals(name)) {
return SimpleType.SHORT;
}
//"javax.management.ObjectName",
//CompositeData.class.getName(),
//TabularData.class.getName()
//}
return null; // is it allowed ??
}