Java 类org.simpleframework.xml.ElementUnion 实例源码

项目:simplexml    文件:FieldScanner.java   
/**
 * This reflectively checks the annotation to determine the type 
 * of annotation it represents. If it represents an XML schema
 * annotation it is used to create a <code>Contact</code> which 
 * can be used to represent the field within the source object.
 * 
 * @param field the field that the annotation comes from
 * @param label the annotation used to model the XML schema
 * @param list this is the list of annotations on the field
 */
private void scan(Field field, Annotation label, Annotation[] list) {
   if(label instanceof Attribute) {
      process(field, label, list);
   }
   if(label instanceof ElementUnion) {
      process(field, label, list);
   }
   if(label instanceof ElementListUnion) {
      process(field, label, list);
   }
   if(label instanceof ElementMapUnion) {
      process(field, label, list);
   }
   if(label instanceof ElementList) {
      process(field, label, list);
   }     
   if(label instanceof ElementArray) {
      process(field, label, list);
   }
   if(label instanceof ElementMap) {
      process(field, label, list);
   }
   if(label instanceof Element) {
      process(field, label, list);
   }       
   if(label instanceof Version) {
      process(field, label, list);
   }
   if(label instanceof Text) {
      process(field, label, list);
   }
   if(label instanceof Transient) {
      remove(field, label);
   }
}
项目:simplexml    文件:MethodScanner.java   
/**
 * This reflectively checks the annotation to determine the type 
 * of annotation it represents. If it represents an XML schema
 * annotation it is used to create a <code>Contact</code> which 
 * can be used to represent the method within the source object.
 * 
 * @param method the method that the annotation comes from
 * @param label the annotation used to model the XML schema
 * @param list this is the list of annotations on the method
 */ 
private void scan(Method method, Annotation label, Annotation[] list) throws Exception {
   if(label instanceof Attribute) {
      process(method, label, list);
   }
   if(label instanceof ElementUnion) {
      process(method, label, list);
   }
   if(label instanceof ElementListUnion) {
      process(method, label, list);
   }
   if(label instanceof ElementMapUnion) {
      process(method, label, list);
   }
   if(label instanceof ElementList) {
      process(method, label, list);
   }
   if(label instanceof ElementArray) {
      process(method, label, list);
   }
   if(label instanceof ElementMap) {
      process(method, label, list);
   }
   if(label instanceof Element) {
      process(method, label, list);
   }    
   if(label instanceof Version) {
      process(method, label, list);
   }
   if(label instanceof Text) {
      process(method, label, list);
   }
   if(label instanceof Transient) {
      remove(method, label, list);
   }
}
项目:simplexml    文件:ParameterFactory.java   
/**
 * Creates an entry that is used to select the constructor for the
 * parameter. Each parameter must implement a constructor that takes 
 * a constructor, and annotation, and the index of the parameter. If
 * the annotation is not know this method throws an exception.
 * 
 * @param label the XML annotation used to create the parameter
 * 
 * @return this returns the entry used to create a constructor
 */
private ParameterBuilder getBuilder(Annotation label) throws Exception{      
   if(label instanceof Element) {
      return new ParameterBuilder(ElementParameter.class, Element.class);
   }
   if(label instanceof ElementList) {
      return new ParameterBuilder(ElementListParameter.class, ElementList.class);
   }
   if(label instanceof ElementArray) {
      return new ParameterBuilder(ElementArrayParameter.class, ElementArray.class);               
   }
   if(label instanceof ElementMapUnion) {
      return new ParameterBuilder(ElementMapUnionParameter.class, ElementMapUnion.class, ElementMap.class);
   }
   if(label instanceof ElementListUnion) {
      return new ParameterBuilder(ElementListUnionParameter.class, ElementListUnion.class, ElementList.class);
   }
   if(label instanceof ElementUnion) {
      return new ParameterBuilder(ElementUnionParameter.class, ElementUnion.class, Element.class);
   }
   if(label instanceof ElementMap) {
      return new ParameterBuilder(ElementMapParameter.class, ElementMap.class);
   }
   if(label instanceof Attribute) {
      return new ParameterBuilder(AttributeParameter.class, Attribute.class);
   }
   if(label instanceof Text) {
      return new ParameterBuilder(TextParameter.class, Text.class);
   }
   throw new PersistenceException("Annotation %s not supported", label);
}
项目:simplexml    文件:SignatureScanner.java   
/**
 * This is used to create <code>Parameter</code> objects which are
 * used to represent the parameters in a constructor. Each parameter
 * contains an annotation an the index it appears in.
 * 
 * @param label this is the annotation used for the parameter
 * @param ordinal this is the position the parameter appears at
 * 
 * @return this returns the parameters for the constructor
 */
private List<Parameter> process(Annotation label, int ordinal) throws Exception{
   if(label instanceof Attribute) {
      return create(label, ordinal);
   }
   if(label instanceof Element) {
      return create(label, ordinal);
   }
   if(label instanceof ElementList) {
      return create(label, ordinal);
   }     
   if(label instanceof ElementArray) {
      return create(label, ordinal);
   }
   if(label instanceof ElementMap) {
      return create(label, ordinal);
   }
   if(label instanceof ElementListUnion) {
      return union(label, ordinal);
   }     
   if(label instanceof ElementMapUnion) {
      return union(label, ordinal);
   }
   if(label instanceof ElementUnion) {
      return union(label, ordinal);
   }
   if(label instanceof Text) {
      return create(label, ordinal);
   }
   return emptyList();
}
项目:simplexml    文件:LabelExtractor.java   
/**
 * Creates a <code>LabelGroup</code> using the provided contact and
 * annotation. The labels produced contain all information related
 * to an object member. It knows the name of the XML entity, as
 * well as whether it is required. Once created the converter can
 * transform an XML node into Java object and vice versa.
 * 
 * @param contact this is contact that the label is produced for
 * @param label represents the XML annotation for the contact
 * 
 * @return returns the list of labels associated with the contact
 */
private LabelGroup getLabels(Contact contact, Annotation label) throws Exception {
   if(label instanceof ElementUnion) {
      return getUnion(contact, label);
   }
   if(label instanceof ElementListUnion) {
      return getUnion(contact, label);
   }
   if(label instanceof ElementMapUnion) {
      return getUnion(contact, label);
   }
   return getSingle(contact, label);
}
项目:simplexml    文件:LabelExtractor.java   
/**
 * Creates an entry that is used to select the constructor for the
 * label. Each label must implement a constructor that takes a
 * contact and the specific XML annotation for that field. If the
 * annotation is not know this method throws an exception.
 * 
 * @param label the XML annotation used to create the label
 * 
 * @return this returns the entry used to create a constructor
 */
private LabelBuilder getBuilder(Annotation label) throws Exception{   
   if(label instanceof Element) {
      return new LabelBuilder(ElementLabel.class, Element.class);
   }
   if(label instanceof ElementList) {
      return new LabelBuilder(ElementListLabel.class, ElementList.class);
   }
   if(label instanceof ElementArray) {
      return new LabelBuilder(ElementArrayLabel.class, ElementArray.class);               
   }
   if(label instanceof ElementMap) {
      return new LabelBuilder(ElementMapLabel.class, ElementMap.class);
   }
   if(label instanceof ElementUnion) {
      return new LabelBuilder(ElementUnionLabel.class, ElementUnion.class, Element.class);
   }
   if(label instanceof ElementListUnion) {
      return new LabelBuilder(ElementListUnionLabel.class, ElementListUnion.class, ElementList.class);
   }
   if(label instanceof ElementMapUnion) {
      return new LabelBuilder(ElementMapUnionLabel.class, ElementMapUnion.class, ElementMap.class);
   }
   if(label instanceof Attribute) {
      return new LabelBuilder(AttributeLabel.class, Attribute.class);
   }
   if(label instanceof Version) {
      return new LabelBuilder(VersionLabel.class, Version.class);
   }
   if(label instanceof Text) {
      return new LabelBuilder(TextLabel.class, Text.class);
   }
   throw new PersistenceException("Annotation %s not supported", label);
}
项目:simplexml    文件:ExtractorFactory.java   
/**
 * This returns a builder used to instantiate an extractor based
 * on a particular union annotation. If the annotation provided
 * does not represent a valid union an exception is thrown.
 * 
 * @param label this is the union annotation to build for
 * 
 * @return this returns a builder used to create an extractor
 */
private ExtractorBuilder getBuilder(Annotation label) throws Exception {
   if(label instanceof ElementUnion) {
      return new ExtractorBuilder(ElementUnion.class, ElementExtractor.class);
   }
   if(label instanceof ElementListUnion) {
      return new ExtractorBuilder(ElementListUnion.class, ElementListExtractor.class);
   }
   if(label instanceof ElementMapUnion) {
      return new ExtractorBuilder(ElementMapUnion.class, ElementMapExtractor.class);
   }
   throw new PersistenceException("Annotation %s is not a union", label);
}
项目:simplexml    文件:StructureBuilder.java   
/**
 * This reflectively checks the annotation to determine the type 
 * of annotation it represents. If it represents an XML schema
 * annotation it is used to create a <code>Label</code> which can
 * be used to represent the field within the context object.
 * 
 * @param field the field that the annotation comes from
 * @param label the annotation used to model the XML schema
 * 
 * @throws Exception if there is more than one text annotation
 */   
public void process(Contact field, Annotation label) throws Exception {
   if(label instanceof Attribute) {
      process(field, label, attributes);
   }
   if(label instanceof ElementUnion) {
      union(field, label, elements);
   }
   if(label instanceof ElementListUnion) {
      union(field, label, elements);
   }
   if(label instanceof ElementMapUnion) {
      union(field, label, elements);
   }
   if(label instanceof ElementList) {
      process(field, label, elements);
   }
   if(label instanceof ElementArray) {
      process(field, label, elements);
   }
   if(label instanceof ElementMap) {
      process(field, label, elements);
   }
   if(label instanceof Element) {
      process(field, label, elements);
   }    
   if(label instanceof Version) {
      version(field, label);
   }
   if(label instanceof Text) {
      text(field, label);
   }
}
项目:simplexml    文件:LabelFactoryTest.java   
public void testUnion() throws Exception {
   FieldScanner scanner = new FieldScanner(new DetailScanner(Example.class), new Support());
   Support support = new Support();
   Contact contact = scanner.get(0);
   Element element = ((ElementUnion)contact.getAnnotation()).value()[0];
   Label unionLabel = support.getLabel(contact, contact.getAnnotation());
   Label elementLabel = support.getLabel(contact, element);

   assertEquals(unionLabel.getName(), "a");
   assertEquals(elementLabel.getName(), "a");
}
项目:simplexml    文件:UnionParameterTest.java   
public ParameterExample(
      @ElementUnion({
         @Element(name="int", type=Integer.class),
         @Element(name="double", type=Double.class),
         @Element(name="string", type=String.class)
      })
      Object value)
{
   this.value = value;
   this.name = "[NOT SET]";
}
项目:simplexml    文件:UnionParameterTest.java   
public ParameterExample(
      @Element(name="name")
      String name,

      @ElementUnion({
         @Element(name="int", type=Integer.class),
         @Element(name="double", type=Double.class),
         @Element(name="string", type=String.class)
      })
      Object value)
{
   this.value = value;
   this.name = name;
}
项目:simplexml    文件:UnionListConstructorInjectionTest.java   
@ElementUnion({
   @Element(name="login"),
   @Element(name="name"),
   @Element(name="user")
})
public String getName(){
   return name;
}
项目:simplexml    文件:SignatureScannerTest.java   
public UnionExample(            
@ElementUnion({
   @Element(name="a", type=String.class),
   @Element(name="b", type=Integer.class),
   @Element(name="c", type=Long.class)
}) 
Object a) {}
项目:simplexml    文件:SignatureScannerTest.java   
public UnionBigPermutationExample(
@ElementUnion({
   @Element(name="a", type=String.class),
   @Element(name="b", type=Integer.class),
   @Element(name="c", type=Long.class)
}) 
Object a,

@ElementUnion({
   @Element(name="x", type=String.class),
   @Element(name="y", type=Integer.class),
   @Element(name="z", type=Long.class)
}) 
Object b) {}
项目:simple-xml    文件:FieldScanner.java   
/**
 * This reflectively checks the annotation to determine the type 
 * of annotation it represents. If it represents an XML schema
 * annotation it is used to create a <code>Contact</code> which 
 * can be used to represent the field within the source object.
 * 
 * @param field the field that the annotation comes from
 * @param label the annotation used to model the XML schema
 * @param list this is the list of annotations on the field
 */
private void scan(Field field, Annotation label, Annotation[] list) {
   if(label instanceof Attribute) {
      process(field, label, list);
   }
   if(label instanceof ElementUnion) {
      process(field, label, list);
   }
   if(label instanceof ElementListUnion) {
      process(field, label, list);
   }
   if(label instanceof ElementMapUnion) {
      process(field, label, list);
   }
   if(label instanceof ElementList) {
      process(field, label, list);
   }     
   if(label instanceof ElementArray) {
      process(field, label, list);
   }
   if(label instanceof ElementMap) {
      process(field, label, list);
   }
   if(label instanceof Element) {
      process(field, label, list);
   }       
   if(label instanceof Version) {
      process(field, label, list);
   }
   if(label instanceof Text) {
      process(field, label, list);
   }
   if(label instanceof Transient) {
      remove(field, label);
   }
}
项目:simple-xml    文件:MethodScanner.java   
/**
 * This reflectively checks the annotation to determine the type 
 * of annotation it represents. If it represents an XML schema
 * annotation it is used to create a <code>Contact</code> which 
 * can be used to represent the method within the source object.
 * 
 * @param method the method that the annotation comes from
 * @param label the annotation used to model the XML schema
 * @param list this is the list of annotations on the method
 */ 
private void scan(Method method, Annotation label, Annotation[] list) throws Exception {
   if(label instanceof Attribute) {
      process(method, label, list);
   }
   if(label instanceof ElementUnion) {
      process(method, label, list);
   }
   if(label instanceof ElementListUnion) {
      process(method, label, list);
   }
   if(label instanceof ElementMapUnion) {
      process(method, label, list);
   }
   if(label instanceof ElementList) {
      process(method, label, list);
   }
   if(label instanceof ElementArray) {
      process(method, label, list);
   }
   if(label instanceof ElementMap) {
      process(method, label, list);
   }
   if(label instanceof Element) {
      process(method, label, list);
   }    
   if(label instanceof Version) {
      process(method, label, list);
   }
   if(label instanceof Text) {
      process(method, label, list);
   }
   if(label instanceof Transient) {
      remove(method, label, list);
   }
}
项目:simple-xml    文件:ParameterFactory.java   
/**
 * Creates an entry that is used to select the constructor for the
 * parameter. Each parameter must implement a constructor that takes 
 * a constructor, and annotation, and the index of the parameter. If
 * the annotation is not know this method throws an exception.
 * 
 * @param label the XML annotation used to create the parameter
 * 
 * @return this returns the entry used to create a constructor
 */
private ParameterBuilder getBuilder(Annotation label) throws Exception{      
   if(label instanceof Element) {
      return new ParameterBuilder(ElementParameter.class, Element.class);
   }
   if(label instanceof ElementList) {
      return new ParameterBuilder(ElementListParameter.class, ElementList.class);
   }
   if(label instanceof ElementArray) {
      return new ParameterBuilder(ElementArrayParameter.class, ElementArray.class);               
   }
   if(label instanceof ElementMapUnion) {
      return new ParameterBuilder(ElementMapUnionParameter.class, ElementMapUnion.class, ElementMap.class);
   }
   if(label instanceof ElementListUnion) {
      return new ParameterBuilder(ElementListUnionParameter.class, ElementListUnion.class, ElementList.class);
   }
   if(label instanceof ElementUnion) {
      return new ParameterBuilder(ElementUnionParameter.class, ElementUnion.class, Element.class);
   }
   if(label instanceof ElementMap) {
      return new ParameterBuilder(ElementMapParameter.class, ElementMap.class);
   }
   if(label instanceof Attribute) {
      return new ParameterBuilder(AttributeParameter.class, Attribute.class);
   }
   if(label instanceof Text) {
      return new ParameterBuilder(TextParameter.class, Text.class);
   }
   throw new PersistenceException("Annotation %s not supported", label);
}
项目:simple-xml    文件:SignatureScanner.java   
/**
 * This is used to create <code>Parameter</code> objects which are
 * used to represent the parameters in a constructor. Each parameter
 * contains an annotation an the index it appears in.
 * 
 * @param label this is the annotation used for the parameter
 * @param ordinal this is the position the parameter appears at
 * 
 * @return this returns the parameters for the constructor
 */
private List<Parameter> process(Annotation label, int ordinal) throws Exception{
   if(label instanceof Attribute) {
      return create(label, ordinal);
   }
   if(label instanceof Element) {
      return create(label, ordinal);
   }
   if(label instanceof ElementList) {
      return create(label, ordinal);
   }     
   if(label instanceof ElementArray) {
      return create(label, ordinal);
   }
   if(label instanceof ElementMap) {
      return create(label, ordinal);
   }
   if(label instanceof ElementListUnion) {
      return union(label, ordinal);
   }     
   if(label instanceof ElementMapUnion) {
      return union(label, ordinal);
   }
   if(label instanceof ElementUnion) {
      return union(label, ordinal);
   }
   if(label instanceof Text) {
      return create(label, ordinal);
   }
   return emptyList();
}
项目:simple-xml    文件:LabelExtractor.java   
/**
 * Creates a <code>LabelGroup</code> using the provided contact and
 * annotation. The labels produced contain all information related
 * to an object member. It knows the name of the XML entity, as
 * well as whether it is required. Once created the converter can
 * transform an XML node into Java object and vice versa.
 * 
 * @param contact this is contact that the label is produced for
 * @param label represents the XML annotation for the contact
 * 
 * @return returns the list of labels associated with the contact
 */
private LabelGroup getLabels(Contact contact, Annotation label) throws Exception {
   if(label instanceof ElementUnion) {
      return getUnion(contact, label);
   }
   if(label instanceof ElementListUnion) {
      return getUnion(contact, label);
   }
   if(label instanceof ElementMapUnion) {
      return getUnion(contact, label);
   }
   return getSingle(contact, label);
}
项目:simple-xml    文件:LabelExtractor.java   
/**
 * Creates an entry that is used to select the constructor for the
 * label. Each label must implement a constructor that takes a
 * contact and the specific XML annotation for that field. If the
 * annotation is not know this method throws an exception.
 * 
 * @param label the XML annotation used to create the label
 * 
 * @return this returns the entry used to create a constructor
 */
private LabelBuilder getBuilder(Annotation label) throws Exception{   
   if(label instanceof Element) {
      return new LabelBuilder(ElementLabel.class, Element.class);
   }
   if(label instanceof ElementList) {
      return new LabelBuilder(ElementListLabel.class, ElementList.class);
   }
   if(label instanceof ElementArray) {
      return new LabelBuilder(ElementArrayLabel.class, ElementArray.class);               
   }
   if(label instanceof ElementMap) {
      return new LabelBuilder(ElementMapLabel.class, ElementMap.class);
   }
   if(label instanceof ElementUnion) {
      return new LabelBuilder(ElementUnionLabel.class, ElementUnion.class, Element.class);
   }
   if(label instanceof ElementListUnion) {
      return new LabelBuilder(ElementListUnionLabel.class, ElementListUnion.class, ElementList.class);
   }
   if(label instanceof ElementMapUnion) {
      return new LabelBuilder(ElementMapUnionLabel.class, ElementMapUnion.class, ElementMap.class);
   }
   if(label instanceof Attribute) {
      return new LabelBuilder(AttributeLabel.class, Attribute.class);
   }
   if(label instanceof Version) {
      return new LabelBuilder(VersionLabel.class, Version.class);
   }
   if(label instanceof Text) {
      return new LabelBuilder(TextLabel.class, Text.class);
   }
   throw new PersistenceException("Annotation %s not supported", label);
}
项目:simple-xml    文件:ExtractorFactory.java   
/**
 * This returns a builder used to instantiate an extractor based
 * on a particular union annotation. If the annotation provided
 * does not represent a valid union an exception is thrown.
 * 
 * @param label this is the union annotation to build for
 * 
 * @return this returns a builder used to create an extractor
 */
private ExtractorBuilder getBuilder(Annotation label) throws Exception {
   if(label instanceof ElementUnion) {
      return new ExtractorBuilder(ElementUnion.class, ElementExtractor.class);
   }
   if(label instanceof ElementListUnion) {
      return new ExtractorBuilder(ElementListUnion.class, ElementListExtractor.class);
   }
   if(label instanceof ElementMapUnion) {
      return new ExtractorBuilder(ElementMapUnion.class, ElementMapExtractor.class);
   }
   throw new PersistenceException("Annotation %s is not a union", label);
}
项目:simple-xml    文件:StructureBuilder.java   
/**
 * This reflectively checks the annotation to determine the type 
 * of annotation it represents. If it represents an XML schema
 * annotation it is used to create a <code>Label</code> which can
 * be used to represent the field within the context object.
 * 
 * @param field the field that the annotation comes from
 * @param label the annotation used to model the XML schema
 * 
 * @throws Exception if there is more than one text annotation
 */   
public void process(Contact field, Annotation label) throws Exception {
   if(label instanceof Attribute) {
      process(field, label, attributes);
   }
   if(label instanceof ElementUnion) {
      union(field, label, elements);
   }
   if(label instanceof ElementListUnion) {
      union(field, label, elements);
   }
   if(label instanceof ElementMapUnion) {
      union(field, label, elements);
   }
   if(label instanceof ElementList) {
      process(field, label, elements);
   }
   if(label instanceof ElementArray) {
      process(field, label, elements);
   }
   if(label instanceof ElementMap) {
      process(field, label, elements);
   }
   if(label instanceof Element) {
      process(field, label, elements);
   }    
   if(label instanceof Version) {
      version(field, label);
   }
   if(label instanceof Text) {
      text(field, label);
   }
}
项目:simple-xml    文件:LabelFactoryTest.java   
public void testUnion() throws Exception {
   FieldScanner scanner = new FieldScanner(new DetailScanner(Example.class), new Support());
   Support support = new Support();
   Contact contact = scanner.get(0);
   Element element = ((ElementUnion)contact.getAnnotation()).value()[0];
   Label unionLabel = support.getLabel(contact, contact.getAnnotation());
   Label elementLabel = support.getLabel(contact, element);

   assertEquals(unionLabel.getName(), "a");
   assertEquals(elementLabel.getName(), "a");
}
项目:simple-xml    文件:UnionParameterTest.java   
public ParameterExample(
      @ElementUnion({
         @Element(name="int", type=Integer.class),
         @Element(name="double", type=Double.class),
         @Element(name="string", type=String.class)
      })
      Object value)
{
   this.value = value;
   this.name = "[NOT SET]";
}
项目:simple-xml    文件:UnionParameterTest.java   
public ParameterExample(
      @Element(name="name")
      String name,

      @ElementUnion({
         @Element(name="int", type=Integer.class),
         @Element(name="double", type=Double.class),
         @Element(name="string", type=String.class)
      })
      Object value)
{
   this.value = value;
   this.name = name;
}
项目:simple-xml    文件:UnionListConstructorInjectionTest.java   
@ElementUnion({
   @Element(name="login"),
   @Element(name="name"),
   @Element(name="user")
})
public String getName(){
   return name;
}
项目:simple-xml    文件:SignatureScannerTest.java   
public UnionExample(            
@ElementUnion({
   @Element(name="a", type=String.class),
   @Element(name="b", type=Integer.class),
   @Element(name="c", type=Long.class)
}) 
Object a) {}
项目:simple-xml    文件:SignatureScannerTest.java   
public UnionBigPermutationExample(
@ElementUnion({
   @Element(name="a", type=String.class),
   @Element(name="b", type=Integer.class),
   @Element(name="c", type=Long.class)
}) 
Object a,

@ElementUnion({
   @Element(name="x", type=String.class),
   @Element(name="y", type=Integer.class),
   @Element(name="z", type=Long.class)
}) 
Object b) {}
项目:simplexml    文件:ConstructorScannerTest.java   
public ClashBetweenElementUnionAndText(
@Path("a/b") @ElementUnion({
   @Element(name="x"),
   @Element(name="y")
}) String a,
@Path("a/b/x") @Text String b){}
项目:simple-xml    文件:ConstructorScannerTest.java   
public ClashBetweenElementUnionAndText(
@Path("a/b") @ElementUnion({
   @Element(name="x"),
   @Element(name="y")
}) String a,
@Path("a/b/x") @Text String b){}
项目:simplexml    文件:ElementUnionLabel.java   
/**
 * Constructor for the <code>ElementUnionLabel</code> object. This 
 * is given the union this represents as well as the individual
 * element it will act as an adapter for. This allows the union
 * label to acquire any other label within the group.
 * 
 * @param contact this is the contact associated with the union
 * @param union this is the union annotation this represents
 * @param element this is the individual annotation used
 * @param format this is the format used to style the union
 */
public ElementUnionLabel(Contact contact, ElementUnion union, Element element, Format format) throws Exception {
   this.extractor = new GroupExtractor(contact, union, format);
   this.label = new ElementLabel(contact, element, format);
   this.contact = contact;
   this.union = union;
}
项目:simplexml    文件:ElementUnionParameter.java   
/**   
 * Constructor for the <code>ElementUnionParameter</code> object.
 * This is used to create a parameter that can be used to 
 * determine a consistent name using the provided XML annotation.
 * 
 * @param factory this is the constructor the parameter is in
 * @param union this is union parameter associated with this
 * @param element this is the annotation used for the parameter
 * @param format this is the format used to style the parameter
 * @param index this is the index the parameter appears at
 */
public ElementUnionParameter(Constructor factory, ElementUnion union, Element element, Format format, int index) throws Exception {
   this.contact = new Contact(element, factory, index);
   this.label = new ElementUnionLabel(contact, union, element, format);
   this.expression = label.getExpression();
   this.path = label.getPath();
   this.type = label.getType();
   this.name = label.getName();
   this.key = label.getKey();
   this.index = index;
}
项目:simple-xml    文件:ElementUnionLabel.java   
/**
 * Constructor for the <code>ElementUnionLabel</code> object. This 
 * is given the union this represents as well as the individual
 * element it will act as an adapter for. This allows the union
 * label to acquire any other label within the group.
 * 
 * @param contact this is the contact associated with the union
 * @param union this is the union annotation this represents
 * @param element this is the individual annotation used
 * @param format this is the format used to style the union
 */
public ElementUnionLabel(Contact contact, ElementUnion union, Element element, Format format) throws Exception {
   this.extractor = new GroupExtractor(contact, union, format);
   this.label = new ElementLabel(contact, element, format);
   this.contact = contact;
   this.union = union;
}
项目:simple-xml    文件:ElementUnionParameter.java   
/**   
 * Constructor for the <code>ElementUnionParameter</code> object.
 * This is used to create a parameter that can be used to 
 * determine a consistent name using the provided XML annotation.
 * 
 * @param factory this is the constructor the parameter is in
 * @param union this is union parameter associated with this
 * @param element this is the annotation used for the parameter
 * @param format this is the format used to style the parameter
 * @param index this is the index the parameter appears at
 */
public ElementUnionParameter(Constructor factory, ElementUnion union, Element element, Format format, int index) throws Exception {
   this.contact = new Contact(element, factory, index);
   this.label = new ElementUnionLabel(contact, union, element, format);
   this.expression = label.getExpression();
   this.path = label.getPath();
   this.type = label.getType();
   this.name = label.getName();
   this.key = label.getKey();
   this.index = index;
}
项目:simplexml    文件:ExtractorFactory.java   
/**
 * Constructor for the <code>ElementExtractor</code> object. This
 * is used to create an extractor that can be used to extract
 * the various labels used to serialize and deserialize objects.
 * 
 * @param contact this is the contact annotated as a union
 * @param union this is the union annotation to extract from
 * @param format this is the format used to style the elements
 */
public ElementExtractor(Contact contact, ElementUnion union, Format format) throws Exception {
   this.contact = contact;
   this.format = format;
   this.union = union;
}
项目:simple-xml    文件:ExtractorFactory.java   
/**
 * Constructor for the <code>ElementExtractor</code> object. This
 * is used to create an extractor that can be used to extract
 * the various labels used to serialize and deserialize objects.
 * 
 * @param contact this is the contact annotated as a union
 * @param union this is the union annotation to extract from
 * @param format this is the format used to style the elements
 */
public ElementExtractor(Contact contact, ElementUnion union, Format format) throws Exception {
   this.contact = contact;
   this.format = format;
   this.union = union;
}