Package org.jboss.xb.binding.sunday.unmarshalling

Examples of org.jboss.xb.binding.sunday.unmarshalling.TermBinding


/* 311 */     if (element == null)
/*     */     {
/* 314 */       ParticleBinding particle = typeBinding.getParticle();
/* 315 */       if (particle != null)
/*     */       {
/* 317 */         TermBinding term = particle.getTerm();
/* 318 */         if ((term instanceof ModelGroupBinding))
/*     */         {
/* 320 */           Iterator iterator = ((ModelGroupBinding)term).getParticles().iterator();
/* 321 */           element = findLocalPathElement(iterator, new String[] { varMapping.getXmlElementName() }, 0);
/*     */         }
View Full Code Here


/*     */       {
/* 488 */         ParticleBinding particle = type.getParticle();
/* 489 */         if (particle == null) {
/*     */           continue;
/*     */         }
/* 492 */         TermBinding term = particle.getTerm();
/* 493 */         if (term.isModelGroup())
/*     */         {
/* 496 */           return findLocalPathElement(((ModelGroupBinding)term).getParticles().iterator(), path, 1);
/*     */         }
/*     */       }
/*     */     }
View Full Code Here

/*     */     }
/* 513 */     ParticleBinding particle = element.getType().getParticle();
/* 514 */     if (particle == null) {
/* 515 */       return null;
/*     */     }
/* 517 */     TermBinding term = particle.getTerm();
/* 518 */     if (!term.isModelGroup()) {
/* 519 */       return null;
/*     */     }
/* 521 */     ModelGroupBinding group = (ModelGroupBinding)term;
/* 522 */     Iterator i = group.getParticles().iterator();
/*     */
View Full Code Here

/*     */
/*     */   private ElementBinding findLocalPathElement(Iterator particles, String[] path, int pos)
/*     */   {
/* 530 */     while (particles.hasNext())
/*     */     {
/* 532 */       TermBinding term = ((ParticleBinding)particles.next()).getTerm();
/* 533 */       if ((term instanceof ElementBinding))
/*     */       {
/* 535 */         ElementBinding element = (ElementBinding)term;
/* 536 */         element = findLocalPathElement(element, path, pos);
/* 537 */         if (element != null) {
View Full Code Here

/*      */     }
/*      */   }
/*      */
/*      */   private boolean marshalParticle(ParticleBinding particle, boolean declareNs)
/*      */   {
/*  644 */     TermBinding term = particle.getTerm();
/*      */
/*  648 */     ParticleBinding ctxParticle = this.ctx.particle;
/*  649 */     MarshallingContextImpl.access$102(this.ctx, particle);
/*      */     boolean marshalled;
/*  651 */     if (term.isModelGroup())
/*      */     {
/*  653 */       ModelGroupBinding modelGroup = (ModelGroupBinding)term;
/*      */       boolean marshalled;
/*  654 */       if ((modelGroup.isSkip()) || (this.stack.isEmpty()))
/*      */       {
/*  656 */         marshalled = marshalModelGroup(modelGroup, declareNs);
/*      */       }
/*      */       else
/*      */       {
/*  660 */         PropertyMetaData propertyMetaData = modelGroup.getPropertyMetaData();
/*  661 */         if (propertyMetaData == null)
/*      */         {
/*  663 */           throw new JBossXBRuntimeException("Currently, property binding metadata must be available for a model group to be marshalled!");
/*      */         }
/*      */
/*  668 */         Object o = getChildren(this.stack.peek(), propertyMetaData.getName(), modelGroup.getSchema().isIgnoreUnresolvedFieldOrClass());
/*      */
/*  672 */         TermBeforeMarshallingCallback marshallingHandler = modelGroup.getBeforeMarshallingCallback();
/*      */
/*  674 */         Iterator i = (o != null) && (isRepeatable(particle)) ? getIterator(o) : null;
/*  675 */         if (i != null)
/*      */         {
/*  677 */           boolean marshalled = true;
/*  678 */           while ((i.hasNext()) && (marshalled))
/*      */           {
/*  680 */             Object value = i.next();
/*      */
/*  682 */             if (marshallingHandler != null)
/*      */             {
/*  684 */               value = marshallingHandler.beforeMarshalling(value, this.ctx);
/*      */             }
/*      */
/*  687 */             this.stack.push(value);
/*  688 */             marshalled = marshalModelGroup(modelGroup, declareNs);
/*  689 */             this.stack.pop();
/*      */           }
/*      */
/*      */         }
/*      */
/*  694 */         if (marshallingHandler != null)
/*      */         {
/*  696 */           o = marshallingHandler.beforeMarshalling(o, this.ctx);
/*      */         }
/*      */
/*  699 */         this.stack.push(o);
/*  700 */         boolean marshalled = marshalModelGroup(modelGroup, declareNs);
/*  701 */         this.stack.pop();
/*      */       }
/*      */
/*      */     }
/*  705 */     else if (term.isWildcard())
/*      */     {
/*  707 */       Object o = this.stack.peek();
/*      */
/*  709 */       boolean popWildcardValue = false;
/*  710 */       ObjectLocalMarshaller marshaller = null;
/*  711 */       AbstractMarshaller.FieldToWildcardMapping mapping = (AbstractMarshaller.FieldToWildcardMapping)this.field2WildcardMap.get(o.getClass());
/*  712 */       if (mapping != null)
/*      */       {
/*  714 */         marshaller = mapping.marshaller;
/*  715 */         o = mapping.fieldInfo.getValue(o);
/*  716 */         this.stack.push(o);
/*  717 */         popWildcardValue = true;
/*      */       }
/*      */
/*  720 */       TermBeforeMarshallingCallback marshallingHandler = term.getBeforeMarshallingCallback();
/*      */
/*  722 */       Iterator i = (o != null) && (isRepeatable(particle)) ? getIterator(o) : null;
/*  723 */       if (i != null)
/*      */       {
/*  725 */         boolean marshalled = true;
View Full Code Here

/*    */ {
/* 42 */   public static final BuilderParticleHandler INSTANCE = new BuilderParticleHandler();
/*    */
/*    */   public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx)
/*    */   {
/* 46 */     TermBinding term = particle.getTerm();
/* 47 */     if ((term instanceof ArraySequenceBinding))
/* 48 */       return new ArrayWrapper(parent, elementName);
/* 49 */     return parent;
/*    */   }
View Full Code Here

/* 49 */     return parent;
/*    */   }
/*    */
/*    */   public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle)
/*    */   {
/* 54 */     TermBinding term = particle.getTerm();
/* 55 */     TermBinding parentTerm = parentParticle.getTerm();
/* 56 */     if ((!term.isModelGroup()) && ((parentTerm instanceof ElementBinding)))
/*    */     {
/* 58 */       ElementBinding elementBinding = (ElementBinding)parentTerm;
/* 59 */       if ((parent != null) && ((parent instanceof ArrayWrapper)))
/*    */       {
View Full Code Here

/*    */     }
/*    */   }
/*    */
/*    */   public Object endParticle(Object o, QName elementName, ParticleBinding particle)
/*    */   {
/* 75 */     TermBinding term = particle.getTerm();
/* 76 */     if ((term instanceof ArraySequenceBinding))
/*    */     {
/* 78 */       ArrayWrapper wrapper = (ArrayWrapper)o;
/* 79 */       Object parent = wrapper.getParent();
/* 80 */       ParticleBinding childParticle = wrapper.getChildParticle();
View Full Code Here

/*     */   public void setParent(Object parent, Object o, QName qName, ParticleBinding particle, ParticleBinding parentParticle)
/*     */   {
/* 132 */     if (this.trace) {
/* 133 */       this.log.trace("setParent " + qName + " parent=" + BuilderUtil.toDebugString(parent) + " child=" + BuilderUtil.toDebugString(o));
/*     */     }
/* 135 */     TermBinding term = particle.getTerm();
/* 136 */     ValueAdapter valueAdapter = null;
/* 137 */     if (term.isModelGroup())
/*     */     {
/* 139 */       QName modelGroupName = ((ModelGroupBinding)term).getQName();
/* 140 */       if (modelGroupName != null)
/*     */       {
/* 142 */         qName = modelGroupName;
/*     */       }
/*     */     }
/* 145 */     else if (term.isElement())
/*     */     {
/* 147 */       valueAdapter = ((ElementBinding)term).getValueAdapter();
/*     */     }
/*     */
/* 150 */     if ((parent != null) && ((parent instanceof ArrayWrapper)))
/*     */     {
/* 152 */       ArrayWrapper wrapper = (ArrayWrapper)parent;
/* 153 */       wrapper.add(o);
/* 154 */       wrapper.setChildParticle(particle);
/* 155 */       wrapper.setParentParticle(parentParticle);
/* 156 */       return;
/*     */     }
/*     */     BeanAdapter beanAdapter;
/*     */     BeanAdapter beanAdapter;
/* 160 */     if ((parent instanceof ArrayWrapper))
/* 161 */       beanAdapter = (BeanAdapter)((ArrayWrapper)parent).getParent();
/*     */     else
/* 163 */       beanAdapter = (BeanAdapter)parent;
/* 164 */     AbstractPropertyHandler propertyHandler = beanAdapter.getPropertyHandler(qName);
/* 165 */     if (propertyHandler == null)
/*     */     {
/* 167 */       AbstractPropertyHandler wildcardHandler = beanAdapter.getWildcardHandler();
/* 168 */       if (wildcardHandler != null)
/*     */       {
/* 170 */         if ((o != null) && ((o instanceof ArrayWrapper)))
/*     */         {
/* 172 */           ArrayWrapper wrapper = (ArrayWrapper)o;
/* 173 */           wildcardHandler.doHandle(beanAdapter, wrapper, wrapper.getElementName());
/* 174 */           return;
/*     */         }
/*     */       }
/* 177 */       TermBinding element = term;
/* 178 */       if (element.getSchema().isStrictSchema())
/*     */       {
/* 180 */         throw new RuntimeException("QName " + qName + " unknown property parent=" + BuilderUtil.toDebugString(parent) + " child=" + BuilderUtil.toDebugString(o) + " available=" + beanAdapter.getAvailable());
/*     */       }
/* 182 */       if (this.trace)
/* 183 */         this.log.trace("QName " + qName + " unknown property parent=" + BuilderUtil.toDebugString(parent) + " child=" + BuilderUtil.toDebugString(o));
View Full Code Here

/*      */
/*   72 */   public static final RtElementHandler INSTANCE = new RtElementHandler();
/*      */
/*      */   public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx)
/*      */   {
/*   88 */     TermBinding term = particle.getTerm();
/*   89 */     Object o = startElement(parent, elementName, particle);
/*   90 */     if (!term.isModelGroup())
/*      */     {
/*   92 */       ElementBinding element = (ElementBinding)term;
/*   93 */       if (o != null)
/*      */       {
/*   95 */         attrs = element.getType().expandWithDefaultAttributes(attrs);
View Full Code Here

TOP

Related Classes of org.jboss.xb.binding.sunday.unmarshalling.TermBinding

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.