Examples of SimpleValue


Examples of org.jboss.metatype.api.values.SimpleValue

 
  public static Long longValue(MetaValue v1) throws Exception {
    if (v1 != null) {
      MetaType type = v1.getMetaType();
      if (type instanceof SimpleMetaType) {
        SimpleValue simple = (SimpleValue) v1;
        return Long.valueOf(simple.getValue().toString());
      }
      throw new Exception("Failed to convert value to long value"); //$NON-NLS-1$
    }
    return null;
  }
View Full Code Here

Examples of org.jboss.metatype.api.values.SimpleValue

 
  public static Integer integerValue(MetaValue v1) throws Exception {
    if (v1 != null) {
      MetaType type = v1.getMetaType();
      if (type instanceof SimpleMetaType) {
        SimpleValue simple = (SimpleValue) v1;
        return Integer.valueOf(simple.getValue().toString());
      }
      throw new Exception("Failed to convert value to integer value"); //$NON-NLS-1$
    }
    return null;
  }
View Full Code Here

Examples of org.jboss.metatype.api.values.SimpleValue

      Class<T> expectedType) {
    ManagedProperty mp = mc.getProperty(prop);
    if (mp != null) {
      MetaType metaType = mp.getMetaType();
      if (metaType.isSimple()) {
        SimpleValue simpleValue = (SimpleValue) mp.getValue();
        return expectedType.cast((simpleValue != null) ? simpleValue
            .getValue() : null);
      } else if (metaType.isEnum()) {
        EnumValue enumValue = (EnumValue) mp.getValue();
        return expectedType.cast((enumValue != null) ? enumValue
            .getValue() : null);
View Full Code Here

Examples of org.jboss.metatype.api.values.SimpleValue

  public static <T> T getSimpleValue(MetaValue prop,
      Class<T> expectedType) {
    if (prop != null) {
      MetaType metaType = prop.getMetaType();
      if (metaType.isSimple()) {
        SimpleValue simpleValue = (SimpleValue) prop;
        return expectedType.cast((simpleValue != null) ? simpleValue
            .getValue() : null);
      } else if (metaType.isEnum()) {
        EnumValue enumValue = (EnumValue) prop;
        return expectedType.cast((enumValue != null) ? enumValue
            .getValue() : null);
View Full Code Here

Examples of org.jboss.metatype.api.values.SimpleValue

      Class<T> expectedType) {
    ManagedProperty mp = mc.getProperty(prop);
    if (mp != null) {
      MetaType metaType = mp.getMetaType();
      if (metaType.isSimple()) {
        SimpleValue simpleValue = (SimpleValue) mp.getValue();
        return expectedType.cast((simpleValue != null) ? simpleValue
            .getValue() : null);
      } else if (metaType.isEnum()) {
        EnumValue enumValue = (EnumValue) mp.getValue();
        return expectedType.cast((enumValue != null) ? enumValue
            .getValue() : null);
View Full Code Here

Examples of org.jboss.metatype.api.values.SimpleValue

          + ") is not simple or enum."); //$NON-NLS-1$
      return;
    }
    PropertyDefinitionSimple propertyDefinitionSimple = (PropertyDefinitionSimple) propertyDefinition;
    if (metaType.isSimple()) {
      SimpleValue defaultSimpleValue = (SimpleValue) defaultValue;
      Serializable value = defaultSimpleValue.getValue();
      propertyDefinitionSimple.setDefaultValue((value != null) ? value.toString() : null);
    } else { // defaultValueMetaType.isEnum()
      EnumValue defaultEnumValue = (EnumValue) defaultValue;
      Serializable value = defaultEnumValue.getValue();
      propertyDefinitionSimple.setDefaultValue((value != null) ? value.toString() : null);
View Full Code Here

Examples of org.jboss.metatype.api.values.SimpleValue

               .parseLong(((SimpleValue) methodStatsMetaValue.get("maxTime")).getValue().toString());
         allMethodStats.add(methodStats);
      }
      invocationStats.methodStats = allMethodStats;

      SimpleValue lastResetTimeMetaValue = (SimpleValue) invocationStatsMetaValue.get("lastResetTime");
      invocationStats.beginTime = Long.valueOf(lastResetTimeMetaValue.getValue().toString()); // TODO: handle null value?

      return invocationStats;
   }
View Full Code Here

Examples of org.jboss.metatype.api.values.SimpleValue

      ManagedProperty password = props.get("password");
      password.setValue(SimpleValueSupport.wrap(""));

      // Remove the
      ManagedProperty useJavaCtx = props.get("use-java-context");
      SimpleValue nullBoolean = SimpleValueSupport.wrap(false);
      ((SimpleValueSupport)nullBoolean).setValue(null);
      useJavaCtx.setValue(nullBoolean);
      useJavaCtx.setRemoved(true);
     
      mgtView.applyTemplate("testRemovedProperties", dsInfo);
View Full Code Here

Examples of org.jboss.metatype.api.values.SimpleValue

      // totalLoadedClassCount
      ManagedProperty totalLoadedClassCount = props.get("totalLoadedClassCount");
      assertNotNull(totalLoadedClassCount);
      assertEquals(SimpleMetaType.LONG_PRIMITIVE, totalLoadedClassCount.getMetaType());
      assertEquals("the total number of classes loaded.", totalLoadedClassCount.getDescription());
      SimpleValue totalLoadedClassCountSV = SimpleValue.class.cast(totalLoadedClassCount.getValue());
      assertNotNull(totalLoadedClassCountSV);
      getLog().debug("totalLoadedClassCountSV"+totalLoadedClassCountSV);
      SimpleValue sv1 = SimpleValueSupport.wrap(new Long(100));
      assertTrue("> 100 classes loaded", sv1.compareTo(totalLoadedClassCountSV) < 0);
      // loadedClassCount
      ManagedProperty loadedClassCount = props.get("loadedClassCount");
      assertNotNull(loadedClassCount);
      assertEquals(SimpleMetaType.INTEGER_PRIMITIVE, loadedClassCount.getMetaType());
      assertEquals("the number of currently loaded classes.", loadedClassCount.getDescription());
      SimpleValue loadedClassCountSV = SimpleValue.class.cast(loadedClassCount.getValue());
      assertNotNull(loadedClassCountSV);
      getLog().debug("loadedClassCountSV"+loadedClassCountSV);
      assertTrue("> 100 classes loaded", sv1.compareTo(loadedClassCountSV) < 0);
      // unloadedClassCount
      ManagedProperty unloadedClassCount = props.get("unloadedClassCount");
      assertNotNull(unloadedClassCount);
      assertEquals(SimpleMetaType.LONG_PRIMITIVE, unloadedClassCount.getMetaType());
      assertEquals("the total number of unloaded classes.", unloadedClassCount.getDescription());
      SimpleValue unloadedClassCountSV = SimpleValue.class.cast(unloadedClassCount.getValue());
      assertNotNull(unloadedClassCountSV);
      getLog().debug("unloadedClassCountSV"+unloadedClassCountSV);
      // verbose
      ManagedProperty verbose = props.get("verbose");
      assertNotNull(verbose);
      assertEquals(SimpleMetaType.BOOLEAN_PRIMITIVE, verbose.getMetaType());
      assertEquals("the verbose output flag for the class loading system.", verbose.getDescription());
      SimpleValue verboseSV = SimpleValue.class.cast(verbose.getValue());
      assertNotNull(verboseSV);
      getLog().debug("verboseSV"+verboseSV);
     
   }
View Full Code Here

Examples of org.jboss.metatype.api.values.SimpleValue

      // verbose
      ManagedProperty verbose = props.get("verbose");
      assertNotNull(verbose);
      assertEquals(SimpleMetaType.BOOLEAN_PRIMITIVE, verbose.getMetaType());
      assertEquals("the verbose output flag for the memory system.", verbose.getDescription());
      SimpleValue verboseSV = SimpleValue.class.cast(verbose.getValue());
      assertNotNull(verboseSV);
      getLog().debug("verboseSV; "+verboseSV);

      // The gc op
      Set<ManagedOperation> ops = mo.getOperations();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.