Package org.jboss.metatype.api.values

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


   }

   @Override
   public ObjectName unwrapMetaValue(MetaValue metaValue)
   {
      PropertiesMetaValue map = (PropertiesMetaValue) metaValue;
      String domain = (String) map.remove("domain");
      try
      {
         return createObjectName(domain, map);
      }
      catch(Exception e)
View Full Code Here


   }

   @Override
   public MetaValue createMetaValue(MetaType metaType, Properties object)
   {
      PropertiesMetaValue map = new PropertiesMetaValue(object);
      return map;
   }
View Full Code Here

   }

   @Override
   public Properties unwrapMetaValue(MetaValue metaValue)
   {
      PropertiesMetaValue map = (PropertiesMetaValue) metaValue;
      return map;
   }
View Full Code Here

            key = key.substring(colon+1);
            props.setProperty("domain", domain);
         }
         props.setProperty(key, kv[1]);
      }
      PropertiesMetaValue metaValue = new PropertiesMetaValue(props);
      return metaValue;
   }
View Full Code Here

   implements DefaultValueBuilder
{

   public MetaValue buildMetaValue(String value) throws Exception
   {
      PropertiesMetaValue metaValue = new PropertiesMetaValue();
      String[] pairs = value.split(";");
      for(int n = 0; n < pairs.length; n ++)
      {
         String[] kv = pairs[n].split("=");
         metaValue.put(kv[0], kv[1]);
      }
      return metaValue;
   }
View Full Code Here

      ManagedProperty nameAsProperties = managedObject.getProperty("nameAsProperties");
      assertTrue(nameAsProperties.getTransientAttachment(MetaMapper.class) != null);
      MetaType nameAsPropertiesType = nameAsProperties.getMetaType();
      assertTrue(nameAsPropertiesType instanceof PropertiesMetaType);
      log.info("nameAsPropertiesType: "+nameAsPropertiesType);
      PropertiesMetaValue props = new PropertiesMetaValue();
      props.put("domain", "nameAsProperties-update");
      props.put("key1", "value1");
      props.put("key2", "value2");
      props.put("key3", "value3");
      nameAsProperties.setValue(props);
      ObjectName nameAsPropertiesON = bean.getNameAsProperties();
      assertEquals("nameAsProperties-update:key1=value1,key2=value2,key3=value3", nameAsPropertiesON.getCanonicalName());
   }
View Full Code Here

      CompositeMetaType nameAsDefaultCMT = (CompositeMetaType) nameAsDefaultType;
      assertTrue(nameAsDefaultCMT.keySet().contains("domain"));
      assertTrue(nameAsDefaultCMT.keySet().contains("keyPropertyList"));
      assertEquals(SimpleMetaType.STRING, nameAsDefaultCMT.getType("domain"));
      assertEquals(PropertiesMetaType.INSTANCE, nameAsDefaultCMT.getType("keyPropertyList"));
      PropertiesMetaValue props = new PropertiesMetaValue();
      props.put("key1", "value1");
      props.put("key2", "value2");
      props.put("key3", "value3");
      String[] itemNames = {"domain", "keyPropertyList"};
      MetaValue[] itemValues = {SimpleValueSupport.wrap("nameAsDefault-update"),
            new PropertiesMetaValue(props)};
      CompositeValueSupport update = new CompositeValueSupport(nameAsDefaultCMT, itemNames, itemValues);
      nameAsDefault.setValue(update);
      ObjectName nameAsDefaultON = bean.getNameAsDefault();
      assertEquals("nameAsDefault-update:key1=value1,key2=value2,key3=value3", nameAsDefaultON.getCanonicalName());
   }
View Full Code Here

    * @return the properties value
    */
   protected MetaValue createPropertiesValue(
         PersistedPropertiesValue value, PropertiesMetaType metaType)
   {
      PropertiesMetaValue properties = new PropertiesMetaValue();
      for(PersistedPair pair : value.getEntries())
      {
         properties.setProperty(pair.getKey(), pair.getValue());
      }

      return properties;
   }
View Full Code Here

TOP

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

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.