Package org.jboss.metatype.api.values

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


      if (value instanceof MetaValue)
      {
         MetaValue metaValue = (MetaValue)value;
         if (metaValue.getMetaType().isSimple() == false)
            throw new IllegalArgumentException("Can only get ref from simple value: " + value);
         SimpleValue svalue = (SimpleValue) metaValue;
         return svalue.getValue();
      }
      return value;
   }
View Full Code Here


    public static Map<String, MetaType> createMetaTypes()
    {
        metaTypeInstances.clear();

        metaTypeInstances.put(GENERIC_TYPE, new GenericMetaType("String", "Just something"));
        SimpleValue simpleValue = SimpleValueSupport.wrap("SimpleValue");
        SimpleMetaType simpleMetaType = simpleValue.getMetaType();
        metaTypeInstances.put(SIMPLE_TYPE, simpleMetaType);
        CompositeMetaType compositeMetaType = new MutableCompositeMetaType("String", "Just something");
        metaTypeInstances.put(COMPOSITE_TYPE, compositeMetaType);
        CompositeMetaType mapCompositeMetaType = new MapCompositeMetaType(SimpleMetaType.STRING);
        metaTypeInstances.put(MAP_COMPOSITE_TYPE, mapCompositeMetaType);
View Full Code Here

                + "' not found for ManagedComponent [" + component + "].");
        }
        MetaType metaType = property.getMetaType();
        Serializable value;
        if (metaType.isSimple()) {
            SimpleValue simpleValue = (SimpleValue) property.getValue();
            value = (simpleValue != null) ? simpleValue.getValue() : null;
        } else if (metaType.isEnum()) {
            EnumValue enumValue = (EnumValue) property.getValue();
            value = (enumValue != null) ? enumValue.getValue() : null;
        } else {
            throw new IllegalStateException("Type of [" + property + "] is not simple or enum.");
View Full Code Here

        if (metaValue == null) {
            return null;
        }
        Object value;
        if (metaValue.getMetaType().isSimple()) {
            SimpleValue simpleValue = (SimpleValue) metaValue;
            value = simpleValue.getValue();
        } else if (metaValue.getMetaType().isEnum()) {
            EnumValue enumValue = (EnumValue) metaValue;
            value = enumValue.getValue();
        } else if (metaValue.getMetaType().isArray()) {
            ArrayValue arrayValue = (ArrayValue) metaValue;
View Full Code Here

        propSimple.setValue(value);
    }

    public MetaValue convertToMetaValue(PropertySimple propSimple, PropertyDefinitionSimple propDefSimple, MetaType metaType)
    {
        SimpleValue simpleValue = new SimpleValueSupport((SimpleMetaType)metaType, null);
        populateMetaValueFromProperty(propSimple, simpleValue, propDefSimple);
        return simpleValue;
    }
View Full Code Here

            ManagedProperty managedProp = managedObject.getProperty(propName);
            if (managedProp != null) {
                MetaType metaType = managedProp.getMetaType();
                Object value;
                if (metaType.isSimple()) {
                    SimpleValue simpleValue = (SimpleValue) managedProp.getValue();
                    value = simpleValue.getValue();
                } else if (metaType.isEnum()) {
                    EnumValue enumValue = (EnumValue) managedProp.getValue();
                    value = enumValue.getValue();
                } else {
                    log.error("Nested ManagedProperty's value [" + managedProp.getValue()
View Full Code Here

        Set<MeasurementScheduleRequest> uncollectedMetrics = new HashSet<MeasurementScheduleRequest>();
        for (MeasurementScheduleRequest request : metrics) {
            try {
                if (request.getName().equals("custom.transactionType")) {
                    ManagedProperty xaTransactionProp = managedComponent.getProperty("xa-transaction");
                    SimpleValue xaTransactionMetaValue = (SimpleValue) xaTransactionProp.getValue();
                    Boolean xaTransactionValue = (xaTransactionMetaValue != null) ? (Boolean) xaTransactionMetaValue
                        .getValue() : null;
                    boolean isXa = (xaTransactionValue != null && xaTransactionValue);
                    String transactionType = (isXa) ? "XA" : "Local";
                    report.addData(new MeasurementDataTrait(request, transactionType));
                } else {
View Full Code Here

            if (key.endsWith(".type"))
            {
                propertyName = key.substring(0, key.length() - 5);

                SimpleValue typeName = (SimpleValue)valuesMap.get(key);

                propertyType = ConfigPropertyType.fromTypeName(typeName
                        .getValue().toString());
            }
            else
            {
                propertyName = key;
                SimpleValue value = (SimpleValue)valuesMap.get(key);
                if (value != null)
                {
                    propertyValue = value.getValue();
                }
            }

            ConfigProperty property = results.get(propertyName);
            if (property == null)
View Full Code Here

                .toString());
            allMethodStats.add(methodStats);
        }
        invocationStats.methodStats = allMethodStats;

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

        return invocationStats;
    }
View Full Code Here

            return null;
        return type.cast(value.getValue());
    }

    public static <T> T getValue(CompositeValue compositeValue, String simpleValueName, Class<T> type) {
        SimpleValue val = (SimpleValue) compositeValue.get(simpleValueName);

        return getValue(val, type);
    }
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.values.SimpleValue

Copyright © 2018 www.massapicom. 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.