Package org.jboss.beans.metadata.plugins

Examples of org.jboss.beans.metadata.plugins.AbstractMapMetaData


   /** The handler */
   public static final MapHandler HANDLER = new MapHandler();

   public Object startElement(Object parent, QName name, ElementBinding element)
   {
      return new AbstractMapMetaData();
   }
View Full Code Here


      return new AbstractMapMetaData();
   }

   public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
   {
      AbstractMapMetaData map = (AbstractMapMetaData) o;
      for (int i = 0; i < attrs.getLength(); ++i)
      {
         String localName = attrs.getLocalName(i);
         if ("class".equals(localName))
            map.setType(attrs.getValue(i));
         else if ("keyClass".equals(localName))
            map.setKeyType(attrs.getValue(i));
         else if ("valueClass".equals(localName))
            map.setValueType(attrs.getValue(i));
      }
   }
View Full Code Here

   /** The handler */
   public static final MapHandler HANDLER = new MapHandler();

   public Object startElement(Object parent, QName name, ElementBinding element)
   {
      return new AbstractMapMetaData();
   }
View Full Code Here

      return new AbstractMapMetaData();
   }

   public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
   {
      AbstractMapMetaData collection = (AbstractMapMetaData) o;
      for (int i = 0; i < attrs.getLength(); ++i)
      {
         String localName = attrs.getLocalName(i);
         if ("class".equals(localName))
            collection.setType(attrs.getValue(i));
         else if ("keyClass".equals(localName))
            collection.setKeyType(attrs.getValue(i));
         else if ("valueClass".equals(localName))
            collection.setValueType(attrs.getValue(i));
      }
   }
View Full Code Here

      if (name == null)
         throw new IllegalArgumentException("Null name");
      PropertyMetaData properties = getProperty("properties");
      if (properties == null)
         return null;
      AbstractMapMetaData map = (AbstractMapMetaData) properties.getValue();
      for (Iterator i = map.entrySet().iterator(); i.hasNext();)
      {
         Map.Entry entry = (Map.Entry) i.next();
         ValueMetaData key = (ValueMetaData) entry.getKey();
         if (key.getUnderlyingValue().equals(name))
         {
View Full Code Here

    */
   public void addBeanProperty(PropertyMetaData property)
   {
      PropertyMetaData properties = getProperty("properties");

      AbstractMapMetaData map;
      if (properties == null)
      {
         map = new AbstractMapMetaData();
         properties = new AbstractPropertyMetaData("properties", map);
         addProperty(properties);
      }
      else
      {
         map = (AbstractMapMetaData) properties.getValue();
      }
     
      ValueMetaData valueMetaData = property.getValue();
      valueMetaData = new AbstractValueMetaData(valueMetaData);
      map.put(new AbstractValueMetaData(property.getName()), valueMetaData);
   }
View Full Code Here

      TypeBinding mapType = schemaBinding.getType(mapTypeQName);
      mapType.setHandler(new DefaultElementHandler()
      {
         public Object startElement(Object parent, QName name, ElementBinding element)
         {
            return new AbstractMapMetaData();
         }

         public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
         {
            AbstractMapMetaData collection = (AbstractMapMetaData) o;
            for (int i = 0; i < attrs.getLength(); ++i)
            {
               String localName = attrs.getLocalName(i);
               if ("class".equals(localName))
                  collection.setType(attrs.getValue(i));
               else if ("keyClass".equals(localName))
                  collection.setKeyType(attrs.getValue(i));
               else if ("valueClass".equals(localName))
                  collection.setValueType(attrs.getValue(i));
            }
         }
      });

      // map has a map entries
      mapType.pushInterceptor(entryQName, new DefaultElementInterceptor()
      {
         public void add(Object parent, Object child, QName name)
         {
            AbstractMapMetaData map = (AbstractMapMetaData) parent;
            MapEntry entry = (MapEntry) child;
            AbstractValueMetaData entryKey = (AbstractValueMetaData) entry.key;
            if (entryKey == null)
               throw new IllegalArgumentException("No key in map entry");
            AbstractValueMetaData entryValue = (AbstractValueMetaData) entry.value;
            if (entryValue == null)
               throw new IllegalArgumentException("No value in map entry");
            map.put((MetaDataVisitorNode) entryKey.getValue(), (MetaDataVisitorNode) entryValue.getValue());
         }
      });

      // entry binding
      TypeBinding entryType = schemaBinding.getType(entryTypeQName);
View Full Code Here

   }
  
   @SuppressWarnings("unchecked")
   public Map<ValueMetaData, ValueMetaData> createMap(String mapType, String keyType, String valueType)
   {
      AbstractMapMetaData map = new AbstractMapMetaData();
      if (mapType != null)
         map.setType(mapType);
      if (keyType != null)
         map.setKeyType(keyType);
      if (valueType != null)
         map.setValue(valueType);
      return (Map) map;
   }
View Full Code Here

      super(MapValue.class);
   }

   public ValueMetaData createValueMetaData(MapValue annotation)
   {
      AbstractMapMetaData map = new AbstractMapMetaData();
      if (isAttributePresent(annotation.clazz()))
         map.setType(annotation.clazz().getName());
      if (isAttributePresent(annotation.keyClass()))
         map.setKeyType(annotation.keyClass().getName());
      if (isAttributePresent(annotation.valueClass()))
         map.setValueType(annotation.valueClass().getName());
      for(EntryValue entry : annotation.value())
      {
         map.put(createValueMetaData(entry.key()), createValueMetaData(entry.value()));
      }
      return map;
   }
View Full Code Here

   }
  
   @SuppressWarnings("unchecked")
   public Map<ValueMetaData, ValueMetaData> createMap(String mapType, String keyType, String valueType)
   {
      AbstractMapMetaData map = new AbstractMapMetaData();
      if (mapType != null)
         map.setType(mapType);
      if (keyType != null)
         map.setKeyType(keyType);
      if (valueType != null)
         map.setValue(valueType);
      return (Map) map;
   }
View Full Code Here

TOP

Related Classes of org.jboss.beans.metadata.plugins.AbstractMapMetaData

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.