[jboss-dev-forums] [Design of JBossXB] - Re: Map annotations

alex.loubyansky@jboss.com do-not-reply at jboss.com
Fri Jan 25 08:30:13 EST 2008


I had to fix some issues based on the MC tests. I've updated the XB snapshot in the maven2 repository.

"mvn" wrote : https://snapshots.jboss.org/maven2/org/jboss/jbossxb/2.0.0-SNAPSHOT/jbossxb-2.0.0-20080125.124437-7.jar

But I haven't updated the MC since it uses 2.0.0.CR5. This is what I did to make sure the MC tests pass
Index: kernel/src/main/org/jboss/beans/metadata/plugins/MapEntry.java
  | ===================================================================
  | --- kernel/src/main/org/jboss/beans/metadata/plugins/MapEntry.java	(revision 69169)
  | +++ kernel/src/main/org/jboss/beans/metadata/plugins/MapEntry.java	(working copy)
  | @@ -24,6 +24,8 @@
  |  import javax.xml.bind.annotation.XmlType;
  |  
  |  import org.jboss.beans.metadata.spi.ValueMetaData;
  | +import org.jboss.xb.annotations.JBossXmlMapKey;
  | +import org.jboss.xb.annotations.JBossXmlMapValue;
  |  
  |  
  |  /**
  | @@ -41,6 +43,7 @@
  |     /** The value */
  |     private ValueMetaData value;
  |  
  | +   @JBossXmlMapKey
  |     public ValueMetaData getKey()
  |     {
  |        return key;
  | @@ -51,6 +54,7 @@
  |        this.key = key;
  |     }
  |  
  | +   @JBossXmlMapValue
  |     public ValueMetaData getValue()
  |     {
  |        return value;
  | Index: kernel/src/main/org/jboss/beans/metadata/plugins/AbstractMapMetaData.java
  | ===================================================================
  | --- kernel/src/main/org/jboss/beans/metadata/plugins/AbstractMapMetaData.java	(revision 69169)
  | +++ kernel/src/main/org/jboss/beans/metadata/plugins/AbstractMapMetaData.java	(working copy)
  | @@ -29,6 +29,7 @@
  |  import java.util.Map;
  |  import java.util.Set;
  |  import javax.xml.bind.annotation.XmlAttribute;
  | +import javax.xml.bind.annotation.XmlTransient;
  |  import javax.xml.bind.annotation.XmlType;
  |  
  |  import org.jboss.beans.metadata.spi.MetaDataVisitor;
  | @@ -36,9 +37,7 @@
  |  import org.jboss.beans.metadata.spi.ValueMetaData;
  |  import org.jboss.reflect.spi.ClassInfo;
  |  import org.jboss.reflect.spi.TypeInfo;
  | -import org.jboss.xb.annotations.JBossXmlChild;
  | -import org.jboss.xb.annotations.JBossXmlChildren;
  | -import org.jboss.xb.annotations.JBossXmlNoElements;
  | +import org.jboss.xb.annotations.JBossXmlMapEntry;
  |  
  |  /**
  |   * Map metadata.
  | @@ -48,11 +47,12 @@
  |   * @version $Revision$
  |   */
  |  @XmlType
  | - at JBossXmlNoElements
  | - at JBossXmlChildren
  | -({
  | -   @JBossXmlChild(name="entry", type=MapEntry.class)
  | -})
  | + at JBossXmlMapEntry(name = "entry", type=MapEntry.class)
  | +//@JBossXmlNoElements
  | +//@JBossXmlChildren
  | +//({
  | +//   @JBossXmlChild(name="entry", type=MapEntry.class)
  | +//})
  |  public class AbstractMapMetaData extends AbstractTypeMetaData
  |     implements Map<MetaDataVisitorNode, MetaDataVisitorNode>, Serializable
  |  {
  | @@ -199,6 +199,7 @@
  |        return map.values();
  |     }
  |  
  | +   @XmlTransient
  |     public Iterator<? extends MetaDataVisitorNode> getChildren()
  |     {
  |        ArrayList<MetaDataVisitorNode> children = new ArrayList<MetaDataVisitorNode>(keySet());
  | @@ -236,11 +237,13 @@
  |      * 
  |      * @return the class instance
  |      */
  | +   @XmlTransient
  |     protected Object getDefaultInstance()
  |     {
  |        return new HashMap<Object, Object>();
  |     }
  |  
  | +   @XmlTransient
  |     protected Class<? extends Map> getExpectedClass()
  |     {
  |        return Map.class;

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4123462#4123462

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4123462



More information about the jboss-dev-forums mailing list