1 22 package org.jboss.kernel.plugins.deployment.xml; 23 24 import javax.xml.namespace.QName ; 25 26 import org.jboss.beans.metadata.plugins.AbstractMapMetaData; 27 import org.jboss.beans.metadata.plugins.AbstractValueMetaData; 28 import org.jboss.beans.metadata.spi.MetaDataVisitorNode; 29 import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; 30 31 37 public class MapEntryInterceptor extends DefaultElementInterceptor 38 { 39 40 public static final MapEntryInterceptor INTERCEPTOR = new MapEntryInterceptor(); 41 42 public void add(Object parent, Object child, QName name) 43 { 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()); 53 } 54 } 55 | Popular Tags |