Package org.jboss.beans.metadata.plugins

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


    */
   public static final SpringMapHandler HANDLER = new SpringMapHandler();

   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 ("key-type".equals(localName))
            map.setKeyType(attrs.getValue(i));
      }
   }
View Full Code Here

/*    */ {
/* 40 */   public static final MapEntryInterceptor INTERCEPTOR = new MapEntryInterceptor();
/*    */
/*    */   public void add(Object parent, Object child, QName name)
/*    */   {
/* 44 */     AbstractMapMetaData map = (AbstractMapMetaData)parent;
/* 45 */     MapEntry entry = (MapEntry)child;
/* 46 */     AbstractValueMetaData entryKey = (AbstractValueMetaData)entry.key;
/* 47 */     if (entryKey == null)
/* 48 */       throw new IllegalArgumentException("No key in map entry");
/* 49 */     AbstractValueMetaData entryValue = (AbstractValueMetaData)entry.value;
/* 50 */     if (entryValue == null)
/* 51 */       throw new IllegalArgumentException("No value in map entry");
/* 52 */     map.put((MetaDataVisitorNode)entryKey.getValue(), (MetaDataVisitorNode)entryValue.getValue());
/*    */   }
View Full Code Here

/* 40 */     super(MapValue.class);
/*    */   }
/*    */
/*    */   public ValueMetaData createValueMetaData(MapValue annotation)
/*    */   {
/* 45 */     AbstractMapMetaData map = new AbstractMapMetaData();
/* 46 */     if (isAttributePresent(annotation.clazz()))
/* 47 */       map.setType(annotation.clazz());
/* 48 */     if (isAttributePresent(annotation.keyClass()))
/* 49 */       map.setKeyType(annotation.keyClass());
/* 50 */     if (isAttributePresent(annotation.valueClass()))
/* 51 */       map.setValueType(annotation.valueClass());
/* 52 */     for (EntryValue entry : annotation.value())
/*    */     {
/* 54 */       map.put(createValueMetaData(entry.key()), createValueMetaData(entry.value()));
/*    */     }
/* 56 */     return map;
/*    */   }
View Full Code Here

/*    */ {
/* 41 */   public static final MapHandler HANDLER = new MapHandler();
/*    */
/*    */   public Object startElement(Object parent, QName name, ElementBinding element)
/*    */   {
/* 45 */     return new AbstractMapMetaData();
/*    */   }
View Full Code Here

/* 45 */     return new AbstractMapMetaData();
/*    */   }
/*    */
/*    */   public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
/*    */   {
/* 50 */     AbstractMapMetaData map = (AbstractMapMetaData)o;
/* 51 */     for (int i = 0; i < attrs.getLength(); i++)
/*    */     {
/* 53 */       String localName = attrs.getLocalName(i);
/* 54 */       if ("class".equals(localName))
/* 55 */         map.setType(attrs.getValue(i));
/* 56 */       else if ("keyClass".equals(localName))
/* 57 */         map.setKeyType(attrs.getValue(i));
/* 58 */       else if ("valueClass".equals(localName))
/* 59 */         map.setValueType(attrs.getValue(i));
/*    */     }
/*    */   }
View Full Code Here

/* 142 */     if (name == null)
/* 143 */       throw new IllegalArgumentException("Null name");
/* 144 */     PropertyMetaData properties = getProperty("properties");
/* 145 */     if (properties == null)
/* 146 */       return null;
/* 147 */     AbstractMapMetaData map = (AbstractMapMetaData)properties.getValue();
/* 148 */     for (Iterator i = map.entrySet().iterator(); i.hasNext(); )
/*     */     {
/* 150 */       Map.Entry entry = (Map.Entry)i.next();
/* 151 */       ValueMetaData key = (ValueMetaData)entry.getKey();
/* 152 */       if (key.getUnderlyingValue().equals(name))
/*     */       {
View Full Code Here

/*     */   }
/*     */
/*     */   public void addBeanProperty(PropertyMetaData property)
/*     */   {
/* 168 */     PropertyMetaData properties = getProperty("properties");
/*     */     AbstractMapMetaData map;
/* 171 */     if (properties == null)
/*     */     {
/* 173 */       AbstractMapMetaData map = new AbstractMapMetaData();
/* 174 */       properties = new AbstractPropertyMetaData("properties", map);
/* 175 */       addProperty(properties);
/*     */     }
/*     */     else
/*     */     {
/* 179 */       map = (AbstractMapMetaData)properties.getValue();
/*     */     }
/*     */
/* 182 */     ValueMetaData valueMetaData = property.getValue();
/* 183 */     valueMetaData = new AbstractValueMetaData(valueMetaData);
/* 184 */     map.put(new AbstractValueMetaData(property.getName()), valueMetaData);
/*     */   }
View Full Code Here

/* 1169 */     TypeBinding mapType = schemaBinding.getType(mapTypeQName);
/* 1170 */     mapType.setHandler(new DefaultElementHandler()
/*      */     {
/*      */       public Object startElement(Object parent, QName name, ElementBinding element)
/*      */       {
/* 1174 */         return new AbstractMapMetaData();
/*      */       }
/*      */
/*      */       public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx)
/*      */       {
/* 1179 */         AbstractMapMetaData collection = (AbstractMapMetaData)o;
/* 1180 */         for (int i = 0; i < attrs.getLength(); i++)
/*      */         {
/* 1182 */           String localName = attrs.getLocalName(i);
/* 1183 */           if ("class".equals(localName))
/* 1184 */             collection.setType(attrs.getValue(i));
/* 1185 */           else if ("keyClass".equals(localName))
/* 1186 */             collection.setKeyType(attrs.getValue(i));
/* 1187 */           else if ("valueClass".equals(localName))
/* 1188 */             collection.setValueType(attrs.getValue(i));
/*      */         }
/*      */       }
/*      */     });
/* 1194 */     mapType.pushInterceptor(entryQName, new DefaultElementInterceptor()
/*      */     {
/*      */       public void add(Object parent, Object child, QName name)
/*      */       {
/* 1198 */         AbstractMapMetaData map = (AbstractMapMetaData)parent;
/* 1199 */         BeanSchemaBinding.MapEntry entry = (BeanSchemaBinding.MapEntry)child;
/* 1200 */         AbstractValueMetaData entryKey = (AbstractValueMetaData)entry.key;
/* 1201 */         if (entryKey == null)
/* 1202 */           throw new IllegalArgumentException("No key in map entry");
/* 1203 */         AbstractValueMetaData entryValue = (AbstractValueMetaData)entry.value;
/* 1204 */         if (entryValue == null)
/* 1205 */           throw new IllegalArgumentException("No value in map entry");
/* 1206 */         map.put((MetaDataVisitorNode)entryKey.getValue(), (MetaDataVisitorNode)entryValue.getValue());
/*      */       }
/*      */     });
/* 1211 */     TypeBinding entryType = schemaBinding.getType(entryTypeQName);
/* 1212 */     entryType.setHandler(new DefaultElementHandler()
/*      */     {
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

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.