Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*     */ package com.sun.xml.bind.v2.runtime.property;
  /*     */ 
  /*     */ import com.sun.xml.bind.v2.ClassFactory;
  /*     */ import com.sun.xml.bind.v2.runtime.JaxBeanInfo;
 /*     */ import com.sun.xml.bind.v2.runtime.Name;
 /*     */ import com.sun.xml.bind.v2.util.QNameMap;
 /*     */ import java.io.IOException;
 /*     */ import javax.xml.bind.JAXBException;
 /*     */ import javax.xml.bind.annotation.DomHandler;
 /*     */ import javax.xml.namespace.QName;
 /*     */ import javax.xml.stream.XMLStreamException;
 /*     */ import org.xml.sax.SAXException;
 /*     */ 
 /*     */ class ArrayReferenceNodeProperty<BeanT, ListT, ItemT> extends ArrayERProperty<BeanT, ListT, ItemT>
 /*     */ {
 /*  72 */   private final QNameMap<JaxBeanInfoexpectedElements = new QNameMap();
 /*     */   private final boolean isMixed;
 /*     */   private final DomHandler domHandler;
 /*     */   private final WildcardMode wcMode;
 /*     */ 
 /*     */   {
 /*  80 */     super(p, prop, prop.getXmlName(), prop.isCollectionNillable());
 /*     */ 
 /*  82 */     for (RuntimeElement e : prop.getElements()) {
 /*  83 */       JaxBeanInfo bi = p.getOrCreate(e);
 /*  84 */       this.expectedElements.put(e.getElementName().getNamespaceURI(), e.getElementName().getLocalPart(), bi);
 /*     */     }
 /*     */ 
 /*  87 */     this.isMixed = prop.isMixed();
 /*     */ 
 /*  89 */     if (prop.getWildcard() != null) {
 /*  90 */       this.domHandler = ((DomHandler)ClassFactory.create((Class)prop.getDOMHandler()));
 /*  91 */       this.wcMode = prop.getWildcard();
 /*     */     } else {
 /*  93 */       this.domHandler = null;
 /*  94 */       this.wcMode = null;
 /*     */     }
 /*     */   }
 /*     */ 
 /*     */   protected final void serializeListBody(BeanT oXMLSerializer w, ListT listthrows IOExceptionXMLStreamExceptionSAXException {
 /*  99 */     ListIterator itr = this.lister.iterator(list, w);
 /*     */ 
 /* 101 */     while (itr.hasNext())
 /*     */       try {
 /* 103 */         Object item = itr.next();
 /* 104 */         if (item != null)
 /* 105 */           if ((this.isMixed) && (item.getClass() == String.class)) {
 /* 106 */             w.text((String)item, null);
 /*     */           } else {
 /* 108 */             JaxBeanInfo bi = w.grammar.getBeanInfo(item, true);
 /* 109 */             if ((bi.jaxbType == Object.class) && (this.domHandler != null))
 /*     */             {
 /* 112 */               w.writeDom(item, this.domHandler, o, this.fieldName);
 /*     */             }
 /* 114 */             else bi.serializeRoot(item, w); 
 /*     */           }
 /*     */       }
 /*     */       catch (JAXBException e)
 /*     */       {
 /* 118 */         w.reportError(this.fieldName, e);
 /*     */       }
 /*     */   }
 /*     */ 
 /*     */   public void createBodyUnmarshaller(UnmarshallerChain chainQNameMap<ChildLoaderloaders)
 /*     */   {
 /* 125 */     int offset = chain.allocateOffset();
 /*     */ 
 /* 127 */     Receiver recv = new ArrayERProperty.ReceiverImpl(this, offset);
 /*     */ 
 /* 129 */     for (QNameMap.Entry n : this.expectedElements.entrySet()) {
 /* 130 */       JaxBeanInfo beanInfo = (JaxBeanInfo)n.getValue();
 /* 131 */       loaders.put(n.nsUri, n.localName, new ChildLoader(beanInfo.getLoader(chain.context, true), recv));
 /*     */     }
 /*     */ 
 /* 134 */     if (this.isMixed)
 /*     */     {
 /* 136 */       loaders.put(TEXT_HANDLER, new ChildLoader(new MixedTextLoader(recv), null));
 /*     */     }
 /*     */ 
 /* 140 */     if (this.domHandler != null)
 /* 141 */       loaders.put(CATCH_ALL, new ChildLoader(new WildcardLoader(this.domHandler, this.wcMode), recv));
 /*     */   }
 /*     */ 
/*     */   public PropertyKind getKind()
/*     */   {
/* 163 */     return PropertyKind.REFERENCE;
/*     */   }
/*     */ 
/*     */   public Accessor getElementPropertyAccessor(String nsUriString localName)
/*     */   {
/* 169 */     if (this.wrapperTagName != null) {
/* 170 */       if (this.wrapperTagName.equals(nsUri, localName))
/* 171 */         return this.acc;
/*     */     }
/* 173 */     else if (this.expectedElements.containsKey(nsUri, localName)) {
/* 174 */       return this.acc;
/*     */     }
/* 176 */     return null;
/*     */   }
/*     */ 
/*     */   private static final class MixedTextLoader extends Loader
/*     */   {
/*     */     private final Receiver recv;
/*     */ 
/*     */     public MixedTextLoader(Receiver recv)
/*     */     {
/* 151 */       super();
/* 152 */       this.recv = recv;
/*     */     }
/*     */ 
/*     */     public void text(UnmarshallingContext.State stateCharSequence textthrows SAXException {
/* 156 */       if (text.length() != 0)
/* 157 */         this.recv.receive(state, text.toString());
/*     */     }
/*     */   }
/*     */ }
/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/thirdparty-all.jar
 * Qualified Name:     com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty
 * JD-Core Version:    0.6.0
 */
New to GrepCode? Check out our FAQ X