Examples of MetaType


Examples of org.jboss.metatype.api.types.MetaType

 
 
  public static <T> T getSimpleValue(ManagedCommon mc, String prop, 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);
       }
       throw new IllegalArgumentException(prop+ " is not a simple type"); //$NON-NLS-1$
     }
View Full Code Here

Examples of org.jboss.metatype.api.types.MetaType

 
 
  public static Properties getPropertiesValue(ManagedCommon mc, String prop) {
     ManagedProperty mp = mc.getProperty(prop);
     if (mp != null) {
       MetaType metaType = mp.getMetaType();
       if (metaType.isProperties()) {
         return (PropertiesMetaValue)mp.getValue();
       }
       else if (metaType.isComposite()) {
        Properties props = new Properties();
        MapCompositeValueSupport map = (MapCompositeValueSupport) mp.getValue();
        MapCompositeMetaType type = map.getMetaType();
        for (String key : type.keySet()) {
          MetaValue value = map.get(key);
View Full Code Here

Examples of org.jboss.metatype.api.types.MetaType

 
 
  public static <T> void getCollectionValue(ManagedCommon mc, String prop, Collection<T> list, Class<T> expectedType) {
     ManagedProperty mp = mc.getProperty(prop);
     if (mp != null) {
       MetaType metaType = mp.getMetaType();
       if (metaType.isCollection()) {
         CollectionValue collectionValue = (CollectionValue)mp.getValue();
         for(MetaValue value:collectionValue.getElements()) {
           if (value.getMetaType().isSimple()) {
             SimpleValue simpleValue = (SimpleValue)value;
             list.add(expectedType.cast(simpleValue.getValue()));
View Full Code Here

Examples of org.jboss.metatype.api.types.MetaType

     
      Map<String, ManagedProperty> managedProperties = mc.getProperties();
      for (ManagedProperty mp: managedProperties.values()) {
        MetaValue value = mp.getValue();
        if (value != null) {
          MetaType type = value.getMetaType();
          if (type.isSimple()) {
            PropertiesUtils.setBeanProperty(t, mp.getMappedName(), ((SimpleValue)value).getValue());
          }
          else if (type.isPrimitive()) {
            PropertiesUtils.setBeanProperty(t, mp.getMappedName(), ((SimpleValue)value).getValue());
          }
          else if (type.isEnum()) {
            PropertiesUtils.setBeanProperty(t, mp.getMappedName(), ((org.jboss.metatype.api.values.EnumValue)value).getValue());
          }
          else if (type.isProperties()) {
           
          }
          else if (type.isComposite()) {
            if (value instanceof MapCompositeValueSupport) {
              HashMap<String, String> myValue = (HashMap<String, String>)MetaValueFactory.getInstance().unwrap(value);
             
              if (mp.getMappedName().equals("JAXBProperties")) { //$NON-NLS-1$
                List<PropertyMetadata> props = new ArrayList<PropertyMetadata>();
                for (String key:myValue.keySet()) {
                  props.add(new PropertyMetadata(key, myValue.get(key)));
                }
                PropertiesUtils.setBeanProperty(t, mp.getMappedName(), props);
              }
              else {
                PropertiesUtils.setBeanProperty(t, mp.getMappedName(), myValue);
              }
            }
          }
          else if (type.isCollection()) {
            List list = new ArrayList();

            MetaType elementType = ((CollectionMetaType) type).getElementType();
            if (elementType == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE) {
              List<ManagedObject> managedObjects = (List<ManagedObject>) MetaValueFactory.getInstance().unwrap(value);
              for (ManagedObject mo : managedObjects) {
                list.add(buildAO(mo, mo.getAttachment().getClass()));
              }
            }
            else if (elementType == SimpleMetaType.STRING) {
              list.addAll((List<String>) MetaValueFactory.getInstance().unwrap(value));
            }
            else if (elementType.isComposite()) {
              list.addAll((List)MetaValueFactory.getInstance().unwrap(value));
            }
            else {
              throw new TeiidRuntimeException("unsupported type"); //$NON-NLS-1$
            }
View Full Code Here

Examples of org.jboss.metatype.api.types.MetaType

    return usedBufferSpace;
  }

  private void getRequestCollectionValue(MetaValue pValue, Collection<RequestMetadata> list) throws Exception {
    MetaType metaType = pValue.getMetaType();
    if (metaType.isCollection()) {
      for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
        if (value.getMetaType().isComposite()) {
          RequestMetadata request = unwrapRequestMetaValue(value);
          list.add(request);
        } else {
View Full Code Here

Examples of org.jboss.metatype.api.types.MetaType

      }
    }
  }

  private void getResultsCollectionValue(MetaValue pValue, Collection<ArrayList<String>> list) throws Exception {
    MetaType metaType = pValue.getMetaType();
    if (metaType.isCollection()) {
      for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
        if (value.getMetaType().isCollection()) {
          ArrayList<String> row = new ArrayList<String>();
          MetaValue[] metaValueArray = ((CollectionValueSupport)value).getElements();
          for (MetaValue cell : metaValueArray){
View Full Code Here

Examples of org.jboss.metatype.api.types.MetaType

      }
    }
  }

  private void getResultsCollectionValueForMatViewRefresh(MetaValue pValue, Collection<ArrayList<String>> list) throws Exception {
    MetaType metaType = pValue.getMetaType();
    for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
      if (value.getMetaType().isCollection()) {
        ArrayList<String> row = new ArrayList<String>();
        MetaValue[] metaValueArray = ((CollectionValueSupport)value).getElements();
        for (MetaValue cell : metaValueArray){
View Full Code Here

Examples of org.jboss.metatype.api.types.MetaType

      }
    }
  }

  public <T> void getTransactionCollectionValue(MetaValue pValue, Collection<TransactionMetadata> list) throws Exception {
    MetaType metaType = pValue.getMetaType();
    if (metaType.isCollection()) {
      for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
        if (value.getMetaType().isComposite()) {
          TransactionMetadata transaction = unwrapTransactionMetaValue(value);
          list.add(transaction);
        } else {
View Full Code Here

Examples of org.jboss.metatype.api.types.MetaType

      }
    }
  }

  public <T> void getSessionCollectionValue(MetaValue pValue,Collection<SessionMetadata> list) throws Exception {
    MetaType metaType = pValue.getMetaType();
    if (metaType.isCollection()) {
      for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
        if (value.getMetaType().isComposite()) {
          SessionMetadata session = unwrapSessionMetaValue(value);
          list.add(session);
        } else {
View Full Code Here

Examples of org.jboss.metatype.api.types.MetaType

      }
    }
  }

  public <T> void getSessionCollectionValueForVDB(MetaValue pValue,Collection<SessionMetadata> list, String vdbName) throws Exception {
    MetaType metaType = pValue.getMetaType();
    if (metaType.isCollection()) {
      for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
        if (value.getMetaType().isComposite()) {
          if (ProfileServiceUtil.stringValue(((CompositeValueSupport)value).get("VDBName")).equals(vdbName)) { //$NON-NLS-1$
            SessionMetadata session = unwrapSessionMetaValue(value);
            list.add(session);
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.