Package org.jboss.xb.builder.runtime

Source Code of org.jboss.xb.builder.runtime.ArrayWrapper

/*     */ package org.jboss.xb.builder.runtime;
/*     */
/*     */ import java.util.ArrayList;
/*     */ import javax.xml.namespace.QName;
/*     */ import org.jboss.reflect.spi.ArrayInfo;
/*     */ import org.jboss.reflect.spi.TypeInfo;
/*     */ import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
/*     */
/*     */ public class ArrayWrapper
/*     */ {
/*     */   private Object parent;
/*     */   private QName elementName;
/*  47 */   private ArrayList<Object> elements = new ArrayList();
/*     */   private ParticleBinding parentParticle;
/*     */   private ParticleBinding childParticle;
/*     */
/*     */   public ArrayWrapper(Object parent, QName elementName)
/*     */   {
/*  63 */     this.parent = parent;
/*  64 */     this.elementName = elementName;
/*     */   }
/*     */
/*     */   public ArrayList<Object> getElements()
/*     */   {
/*  74 */     return this.elements;
/*     */   }
/*     */
/*     */   public Object getParent()
/*     */   {
/*  84 */     return this.parent;
/*     */   }
/*     */
/*     */   public QName getElementName()
/*     */   {
/*  94 */     return this.elementName;
/*     */   }
/*     */
/*     */   public void add(Object obj)
/*     */   {
/* 104 */     this.elements.add(obj);
/*     */   }
/*     */
/*     */   public ParticleBinding getChildParticle()
/*     */   {
/* 114 */     return this.childParticle;
/*     */   }
/*     */
/*     */   public void setChildParticle(ParticleBinding childParticle)
/*     */   {
/* 124 */     this.childParticle = childParticle;
/*     */   }
/*     */
/*     */   public ParticleBinding getParentParticle()
/*     */   {
/* 134 */     return this.parentParticle;
/*     */   }
/*     */
/*     */   public void setParentParticle(ParticleBinding parentParticle)
/*     */   {
/* 144 */     this.parentParticle = parentParticle;
/*     */   }
/*     */
/*     */   public Object[] getArray(TypeInfo propertyType)
/*     */   {
/* 155 */     ArrayInfo arrayInfo = (ArrayInfo)propertyType;
/*     */     try
/*     */     {
/* 158 */       Object[] result = (Object[])(Object[])arrayInfo.newArrayInstance(this.elements.size());
/* 159 */       for (int i = 0; i < result.length; i++)
/* 160 */         result[i] = this.elements.get(i);
/* 161 */       return result;
/*     */     }
/*     */     catch (Throwable t) {
/*     */     }
/* 165 */     throw new RuntimeException("Error creating array of type " + arrayInfo.getName() + " from " + this.elements, t);
/*     */   }
/*     */ }

/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
* Qualified Name:     org.jboss.xb.builder.runtime.ArrayWrapper
* JD-Core Version:    0.6.0
*/
TOP

Related Classes of org.jboss.xb.builder.runtime.ArrayWrapper

TOP
Copyright © 2018 www.massapi.com. 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.