org.simpleframework.xml.Path Java Examples

The following examples show how to use org.simpleframework.xml.Path. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UnionComplicatedPathMixTest.java    From simplexml with Apache License 2.0 6 votes vote down vote up
public ComplicatedExample(
      @Path("x:path[1]") @ElementMap(name="a") Map<Key, Entry> map,
      @Path("x:path[2]") @ElementList(name="a") List<Entry> list,
      @Element(name="elementOne") String elementOne,
      @Element(name="elementTwo") String elementTwo,
      @Element(name="elementThree") String elementThree,
      @Text String text,
      @Path("x:path[2]/x:someOtherPath") @Attribute(name="attribute_one") String attribute_one,
      @Path("x:path[2]/x:someOtherPath") @Attribute(name="attribute_two") String attribute_two) 
{
   this.map = map;
   this.list = list;
   this.elementOne = elementOne;
   this.elementTwo = elementTwo;
   this.elementThree = elementThree;
   this.text = text;
   this.attribute_one = attribute_one;
   this.attribute_two = attribute_two;
}
 
Example #2
Source File: PathWithTextAndElementTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
private PathWithTextAndElementExample(
      @Text String text,
      @Path("some/path") @Attribute(name="name") String value,
      @Path("some") @Element(name="name") String item) 
{
   this.item = item;
   this.value = value;
   this.text = text;
}
 
Example #3
Source File: Test3_2Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public Test3_3(   @Path(value="elements")
            @ElementListUnion({
               @ElementList(entry="element-a", type=MyElementA.class, inline=true),
               @ElementList(entry="element-b", type=MyElementB.class, inline=true)
            })
            final java.util.Collection<MyElement> elements
      ) {
   super();
   this.elements = elements;
}
 
Example #4
Source File: Test3_2Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public Test3_2(   @Path(value="elements")
            @ElementListUnion({
               @ElementList(entry="element-a", type=MyElementA.class, inline=true),
               @ElementList(entry="element-b", type=MyElementB.class, inline=true)
            })
            final java.util.ArrayList<MyElement> elements
      ) {
   super();
   this.elements = elements;
}
 
Example #5
Source File: Test3_2Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
@Path(value="elements")
@ElementListUnion({
   @ElementList(entry="element-a", type=MyElementA.class, inline=true),
   @ElementList(entry="element-b", type=MyElementB.class, inline=true)
})
public java.util.ArrayList<MyElement> getElements(){
   return new java.util.ArrayList<MyElement>(this.elements);
}
 
Example #6
Source File: PathConstructorAmbiguityTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public Test1(
      @Attribute(name="iri")  String identifier,
      @Path(value="resource") @Attribute(name="iri") String identifier1)
{
   this.identifier = identifier;
   this.identifier1 = identifier1;
}
 
Example #7
Source File: CompositeListUnionTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
private static Group getGroup() throws Exception {
   Field field = CompositeListUnionTest.class.getDeclaredField("EXAMPLE");
   Annotation annotation = field.getAnnotation(ElementListUnion.class);
   Annotation path = field.getAnnotation(Path.class);
   return new GroupExtractor(
         new FieldContact(field, annotation, new Annotation[]{annotation, path}),
         annotation,
         new Format());
}
 
Example #8
Source File: UnionWithSameNamesAndDifferentPathsTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public AmbiguousConstructorParameterExample(
      @Element(name="b") String ambiguous, 
      @Path("path[2]") @Element(name="b") String y)
{
   this.y = y;
   this.x = ambiguous;
}
 
Example #9
Source File: UnionWithSameNamesAndDifferentPathsTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public Example(
      @Path("path[1]") @Element(name="b") String x, 
      @Path("path[2]") @Element(name="b") String y)
{
   this.y = y;
   this.x = x;
}
 
Example #10
Source File: Test5Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
@Path(value="elements")
@ElementListUnion({
   @ElementList(entry="elementA", type=MyElementA.class, inline=true),
   @ElementList(entry="elementB", type=MyElementB.class, inline=true),
   @ElementList(entry="element", type=MyElement.class, inline=true)
})
void setElements(final java.util.ArrayList<MyElement> elements){
   this.elements = elements;
}
 
Example #11
Source File: Test5Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
@Path(value="elements")
@ElementListUnion({
   @ElementList(entry="elementA", type=MyElementA.class, inline=true),
   @ElementList(entry="elementB", type=MyElementB.class, inline=true),
   @ElementList(entry="element", type=MyElement.class, inline=true)
})
java.util.ArrayList<MyElement> getElements(){
   return this.elements;
}
 
Example #12
Source File: PathWithTextAndElementTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
private PathWithMultipleTextExample(
      @Attribute(name="a") String a,
      @Path("valuePath[1]") @Text String b,
      @Attribute(name="c") String c,
      @Path("valuePath[2]") @Text String d)
{
   this.a = a;
   this.b = b;
   this.c = c;
   this.d = d;
}
 
Example #13
Source File: PathWithTextAndElementTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
private OtherPathWithTextAndElementExample(
      @Path("valuePath/path") @Attribute(name="name") String a,
      @Path("someOtherPath/path") @Element(name="name") String b,
      @Text String c) 
{
   this.a = a;
   this.b = b;
   this.c = c;
}
 
Example #14
Source File: Introspector.java    From simplexml with Apache License 2.0 5 votes vote down vote up
/**
 * This is used to acquire the path of the element or attribute
 * that is used by the class schema. The path is determined by
 * acquiring the XPath expression and appending the name of the
 * label to form a fully qualified path.
 * 
 * @return returns the path that is used for the XML property
 */
public String getPath() throws Exception {
   Path path = contact.getAnnotation(Path.class);
   
   if(path == null) {
      return null;
   }
   return path.value();
}
 
Example #15
Source File: Test1Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public Test1(
      @Attribute(name="iri") final String identifier,
      @Path(value="resource")@Attribute(name="iri") final String identifier1)
{
   super();
   this.identifier = identifier;
   this.identifier1 = identifier1;
}
 
Example #16
Source File: UnionElementListInConstructorTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public InlineListUnion(
      @Path("x:path[1]") @ElementList(name="a") List<Entry> one,
      @Path("y:path[2]") @ElementList(name="a") List<Entry> two)
{
   this.one = one;
   this.two = two;
}
 
Example #17
Source File: Test3Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public Test3(  @Path(value="elements")
            @ElementListUnion({
               @ElementList(entry="element-a", type=MyElementA.class, inline=true),
               @ElementList(entry="element-b", type=MyElementB.class, inline=true)
            })
            final java.util.ArrayList<MyElement> elements
      ) {
   super();
   this.elements = elements;
}
 
Example #18
Source File: Test4Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
@Path(value="elements")
@ElementListUnion({
   @ElementList(entry="elementA", type=MyElementA.class, inline=true),
   @ElementList(entry="elementB", type=MyElementB.class, inline=true),
   @ElementList(entry="element", type=MyElement.class, inline=true)
})
java.util.ArrayList<MyElement> getElements(){
   return this.elements;
}
 
Example #19
Source File: Test4Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
@Path(value="elements")
@ElementListUnion({
   @ElementList(entry="elementA", type=MyElementA.class, inline=true),
   @ElementList(entry="elementB", type=MyElementB.class, inline=true),
   @ElementList(entry="element", type=MyElement.class, inline=true)
})
void setElements(final java.util.ArrayList<MyElement> elements){
   this.elements = elements;
}
 
Example #20
Source File: ConstructorScannerTest.java    From simplexml with Apache License 2.0 4 votes vote down vote up
public ClashBetweenElementAndText(
@Path("a/b") @Element(name="c") String a) {}
 
Example #21
Source File: PathDuplicateTest.java    From simplexml with Apache License 2.0 4 votes vote down vote up
public Example(
      @Path("y[1]") @Element(name="x") String x, 
      @Path("y[2]") @Element(name="x") String z) {
   this.a = x;
   this.b = z;
}
 
Example #22
Source File: PathDuplicateTest.java    From simplexml with Apache License 2.0 4 votes vote down vote up
public StyleExample(
      @Path("path[1]/details") @Element(name="name") String x, 
      @Path("path[2]/details") @Element(name="name") String z) {
   this.a = x;
   this.b = z;
}
 
Example #23
Source File: PathTextTest.java    From simplexml with Apache License 2.0 4 votes vote down vote up
public TextExample(
      @Path("path[1]/details") @Text String x, 
      @Path("path[2]/details") @Text String z) {
   this.a = x;
   this.b = z;
}
 
Example #24
Source File: ConstructorScannerTest.java    From simplexml with Apache License 2.0 4 votes vote down vote up
public ExampleWithTextAndElement(
@Path("a") @Text String a, 
@Element(name="b") String b, 
@Element(name="c") String c) {}
 
Example #25
Source File: ConstructorScannerTest.java    From simplexml with Apache License 2.0 4 votes vote down vote up
public ClashInText(
@Path("a/b/x") @Text String a,
@Path("a/b/x") @Text String b){}
 
Example #26
Source File: PathCaseTest.java    From simplexml with Apache License 2.0 4 votes vote down vote up
public OtherCaseExample(
      @Path("FirstPath[1]/SecondPath[1]") @Element(name="a") String a, 
      @Path("FirstPath[1]/secondPath[1]") @Element(name="b") String b) {
   this.a = a;
   this.b = b;
}
 
Example #27
Source File: PathCaseTest.java    From simplexml with Apache License 2.0 4 votes vote down vote up
public CollisionExample(
      @Path("SomePath[1]") @Element(name="a") String a, 
      @Path("somePath[1]") @Element(name="a") String b) {
   this.a = a;
   this.b = b;
}
 
Example #28
Source File: PathCaseTest.java    From simplexml with Apache License 2.0 4 votes vote down vote up
public CaseExample(
      @Path("SomePath[1]") @Element(name="a") String a, 
      @Path("somePath[1]") @Element(name="b") String b) {
   this.a = a;
   this.b = b;
}
 
Example #29
Source File: PathWithTextInAPathTest.java    From simplexml with Apache License 2.0 4 votes vote down vote up
public InvalidTextWithCrossingPath(
   @Path("a/b") @Text String a,
   @Path("a/b/c") @Text String b) {
      this.a = a;
      this.b = b;
}
 
Example #30
Source File: ConstructorScannerTest.java    From simplexml with Apache License 2.0 4 votes vote down vote up
public ClashBetweenElementAndText(
@Path("a/b/c") @Text String a,
@Element(name="c") String c) {}