当前位置: 首页>>代码示例>>Java>>正文


Java SimpleType.INTEGER属性代码示例

本文整理汇总了Java中javax.management.openmbean.SimpleType.INTEGER属性的典型用法代码示例。如果您正苦于以下问题:Java SimpleType.INTEGER属性的具体用法?Java SimpleType.INTEGER怎么用?Java SimpleType.INTEGER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.management.openmbean.SimpleType的用法示例。


在下文中一共展示了SimpleType.INTEGER属性的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 + "]");
    }
}
 
开发者ID:performancecopilot,项目名称:parfait,代码行数:16,代码来源:JmxView.java

示例2: getThrottleConfig

@Override
// MBean method
// @Description is set at the interface level
public final CompositeDataSupport getThrottleConfig() throws OpenDataException {

    final CompositeType throttleConfigurationType = new CompositeType(
            "Throttle Configuration",
            "Throttle Configuration",
            new String[]{"Throttle (in ms)", "Batch size"},
            new String[]{"Throttle (in ms)", "Batch size"},
            new OpenType[]{SimpleType.INTEGER, SimpleType.INTEGER}
    );

    final Map<String, Object> data = new HashMap<String, Object>();
    data.put("Throttle (in ms)", this.throttle.get());
    data.put("Batch size", this.batchSize.get());
    return new CompositeDataSupport(throttleConfigurationType, data);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-samples,代码行数:18,代码来源:SampleContentReplicationHarnessImpl.java

示例3: 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());
	}
}
 
开发者ID:softindex,项目名称:datakernel,代码行数:23,代码来源:AttributeNodeForSimpleType.java

示例4: before

@Before
public void before() throws OpenDataException {
	exceptionDetailsItemNames = new String[]{
			"lastException",
			"lastExceptionCausedObject",
			"lastExceptionStackTrace",
			"lastExceptionTimestamp",
			"totalExceptions"
	};

	exceptionDetailsItemTypes = new OpenType<?>[]{
			SimpleType.STRING,
			SimpleType.STRING,
			new ArrayType<>(1, SimpleType.STRING),
			SimpleType.LONG,
			SimpleType.INTEGER
	};
}
 
开发者ID:softindex,项目名称:datakernel,代码行数:18,代码来源:ExceptionStatsTest.java

示例5: 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;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:ManagementUtils.java

示例6: createGoodStackTraceElementCompositeType

private static CompositeType createGoodStackTraceElementCompositeType() {
    CompositeType result = 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 {
        result = new CompositeType(StackTraceElement.class.getName(),
                StackTraceElement.class.getName(), typeNames, typeDescs,
                typeTypes);
    } catch (OpenDataException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return result;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:ThreadInfoTest.java

示例7: 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();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-core,代码行数:35,代码来源:JMXUtils.java

示例8: 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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:CompatibilityTest.java

示例9: 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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:37,代码来源:ThreadInfo.java

示例10: 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;
 }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:37,代码来源:ThreadInfo.java

示例11: 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;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:29,代码来源:JMXUtils.java

示例12: main

public static void main(String[] args) throws Exception {
    MBeanServer mbs = MBeanServerFactory.newMBeanServer();
    ObjectName pointName = new ObjectName("a:type=Point");
    PointMXBean pointmx = new PointImpl();
    mbs.registerMBean(pointmx, pointName);
    Point point = new Point(1, 2);
    PointMXBean pointproxy =
        JMX.newMXBeanProxy(mbs, pointName, PointMXBean.class);
    Point point1 = pointproxy.identity(point);
    if (point1.getX() != point.getX() || point1.getY() != point.getY())
        throw new Exception("Point doesn't match");
    System.out.println("Point test passed");

    ObjectName evolveName = new ObjectName("a:type=Evolve");
    EvolveMXBean evolvemx = new EvolveImpl();
    mbs.registerMBean(evolvemx, evolveName);
    Evolve evolve =
        new Evolve(59, "tralala", Collections.singletonList("tiddly"));
    EvolveMXBean evolveProxy =
        JMX.newMXBeanProxy(mbs, evolveName, EvolveMXBean.class);
    Evolve evolve1 = evolveProxy.identity(evolve);
    if (evolve1.getOldInt() != evolve.getOldInt()
            || !evolve1.getNewString().equals(evolve.getNewString())
            || !evolve1.getNewerList().equals(evolve.getNewerList()))
        throw new Exception("Evolve doesn't match");
    System.out.println("Evolve test passed");

    ObjectName evolvedName = new ObjectName("a:type=Evolved");
    EvolveMXBean evolvedmx = new EvolveImpl();
    mbs.registerMBean(evolvedmx, evolvedName);
    CompositeType evolvedType =
        new CompositeType("Evolved", "descr", new String[] {"oldInt"},
                          new String[] {"oldInt descr"},
                          new OpenType[] {SimpleType.INTEGER});
    CompositeData evolvedData =
        new CompositeDataSupport(evolvedType, new String[] {"oldInt"},
                                 new Object[] {5});
    CompositeData evolved1 = (CompositeData)
        mbs.invoke(evolvedName, "identity", new Object[] {evolvedData},
                   new String[] {CompositeData.class.getName()});
    if ((Integer) evolved1.get("oldInt") != 5
            || !evolved1.get("newString").equals("defaultString")
            || ((String[]) evolved1.get("newerList")).length != 0)
        throw new Exception("Evolved doesn't match: " + evolved1);
    System.out.println("Evolved test passed");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:46,代码来源:PropertyNamesTest.java

示例13: main

public static void main(String[] args) throws Exception {
    CompositeType basicCT = new CompositeType(
            "basicCT", "basic CompositeType",
            new String[] {"name", "value"},
            new String[] {"name", "value"},
            new OpenType<?>[] {SimpleType.STRING, SimpleType.INTEGER});
    CompositeType ct = new CompositeType(
            "noddy", "descr",
            new String[] {"strings", "ints", "cds"},
            new String[] {"string array", "int array", "composite data array"},
            new OpenType<?>[] {
                ArrayType.getArrayType(SimpleType.STRING),
                ArrayType.getPrimitiveArrayType(int[].class),
                ArrayType.getArrayType(basicCT)
            });
    CompositeData basicCD1 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"ceathar", 4});
    CompositeData basicCD2 = new CompositeDataSupport(
            basicCT, new String[] {"name", "value"}, new Object[] {"naoi", 9});
    CompositeData cd = new CompositeDataSupport(
            ct,
            new String[] {"strings", "ints", "cds"},
            new Object[] {
                new String[] {"fred", "jim", "sheila"},
                new int[] {2, 3, 5, 7},
                new CompositeData[] {basicCD1, basicCD2}
            });
    String s = cd.toString();
    System.out.println("CompositeDataSupport.toString(): " + s);
    String[] expected = {
        "fred, jim, sheila",
        "2, 3, 5, 7",
        "ceathar",
        "naoi",
    };
    boolean ok = true;
    for (String expect : expected) {
        if (s.contains(expect))
            System.out.println("OK: string contains <" + expect + ">");
        else {
            ok = false;
            System.out.println("NOT OK: string does not contain <" +
                    expect + ">");
        }
    }
    if (ok)
        System.out.println("TEST PASSED");
    else
        throw new Exception("TEST FAILED: string did not contain expected substrings");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:50,代码来源:CompositeDataStringTest.java

示例14: 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;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:78,代码来源:GcInfoBuilder.java

示例15: 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;
}
 
开发者ID:JetBrains,项目名称:jdk8u_jdk,代码行数:78,代码来源:GcInfoBuilder.java


注:本文中的javax.management.openmbean.SimpleType.INTEGER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。