Package net.sf.jelly.apt.decorations.declaration

Examples of net.sf.jelly.apt.decorations.declaration.PropertyDeclaration


    rootElementDeclaration = new RootElementDeclaration(decl, type);
    model.add(type);
    model.add(rootElementDeclaration);

    ComplexTypeDefinition typeDef = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.anotherschema.ElementRefsBean"));
    PropertyDeclaration property = findProperty(typeDef, "foursAndThrees");
    ElementRef element = new ElementRef(property, typeDef);
    Collection<ElementRef> choices = element.getChoices();
    assertEquals(2, choices.size());
    Iterator<ElementRef> iterator = choices.iterator();
    ElementRef firstChoice = iterator.next();
View Full Code Here


  /**
   * Tests a default, simple, single-valued accessor
   */
  public void testSimpleSingleValuedProperty() throws Exception {
    ComplexTypeDefinition typeDef = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne"));
    PropertyDeclaration property = findProperty(typeDef, "property4");
    Element element = new Element(property, typeDef);
    assertEquals(1, element.getChoices().size());
    assertSame(element, element.getChoices().iterator().next());
    assertEquals("property4", element.getName());
    assertNull("The namespace should be null because the elementFormDefault is unset.", element.getNamespace());
    assertNull(element.getRef());
    assertEquals(property.getPropertyType(), element.getAccessorType());
    assertEquals(KnownXmlType.STRING, element.getBaseType());
    assertFalse(element.isNillable());
    assertFalse(element.isRequired());
    assertEquals(0, element.getMinOccurs());
    assertEquals("1", element.getMaxOccurs());
View Full Code Here

  /**
   * Tests a byte[] accessor
   */
  public void testByteArrayProperty() throws Exception {
    ComplexTypeDefinition typeDef = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne"));
    PropertyDeclaration property = findProperty(typeDef, "property6");
    Element element = new Element(property, typeDef);
    assertEquals(1, element.getChoices().size());
    assertSame(element, element.getChoices().iterator().next());
    assertEquals("property6", element.getName());
    assertNull("The namespace should be null because the elementFormDefault is unset.", element.getNamespace());
    assertNull(element.getRef());
    assertEquals(property.getPropertyType(), element.getAccessorType());
    assertEquals(KnownXmlType.BASE64_BINARY, element.getBaseType());
    assertFalse(element.isNillable());
    assertFalse(element.isRequired());
    assertTrue(element.isBinaryData());
    assertEquals(0, element.getMinOccurs());
    assertEquals("1", element.getMaxOccurs());
    assertNull(element.getDefaultValue());
    assertFalse(element.isWrapped());

    //now let's pretend its a value...
    Value value = new Value(property, typeDef);
    assertEquals(null, value.getName());
    assertEquals(property.getPropertyType(), value.getAccessorType());
    assertEquals(KnownXmlType.BASE64_BINARY, value.getBaseType());
    assertTrue(value.isBinaryData());
    assertFalse(((DecoratedTypeMirror) value.getAccessorType()).isPrimitive());
  }
View Full Code Here

   * Tests a looping accessor, as per the jaxb spec, section 8.9.1.2
   */
  public void testLoopingProperty() throws Exception {
    ComplexTypeDefinition typeDef = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne"));
    ((EnunciateFreemarkerModel) FreemarkerModel.get()).add(typeDef);
    PropertyDeclaration property = findProperty(typeDef, "loopingProperty1");
    Element element = new Element(property, typeDef);
    assertEquals(1, element.getChoices().size());
    assertSame(element, element.getChoices().iterator().next());
    assertEquals("loopingProperty1", element.getName());
    assertNull("The namespace should be null because the elementFormDefault is unset.", element.getNamespace());
View Full Code Here

  /**
   * Tests a simple, single-valued accessor with different specified values.
   */
  public void testSpecifiedSimpleSingleValuedProperty() throws Exception {
    ComplexTypeDefinition typeDef = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne"));
    PropertyDeclaration property = findProperty(typeDef, "property3");
    Element element = new Element(property, typeDef);
    assertEquals(1, element.getChoices().size());
    assertSame(element, element.getChoices().iterator().next());
    assertEquals("changedname", element.getName());
    assertEquals("urn:changedname", element.getNamespace());
    assertNotNull(element.getRef());
    assertEquals(property.getPropertyType(), element.getAccessorType());
    assertEquals(KnownXmlType.INT.getQname(), element.getBaseType().getQname());
    assertTrue(element.isNillable());
    assertTrue(element.isRequired());
    assertEquals(1, element.getMinOccurs());
    assertEquals("1", element.getMaxOccurs());
View Full Code Here

   */
  public void testSpecifiedTypeSingleValuedProperty() throws Exception {
    EnumTypeDefinition enumDef = new EnumTypeDefinition((EnumDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.EnumBeanOne"));
    ((EnunciateFreemarkerModel) FreemarkerModel.get()).add(enumDef);
    ComplexTypeDefinition typeDef = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne"));
    PropertyDeclaration property = findProperty(typeDef, "property5");
    Element element = new Element(property, typeDef);
    assertEquals(1, element.getChoices().size());
    assertSame(element, element.getChoices().iterator().next());
    assertEquals("property5", element.getName());
    assertNull(element.getNamespace());
View Full Code Here

  /**
   * Tests a default single-choice collection property
   */
  public void testDefaultSingleChoiceCollectionProperty() throws Exception {
    ComplexTypeDefinition typeDef = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne"));
    PropertyDeclaration property = findProperty(typeDef, "elementsProperty2");
    Element element = new Element(property, typeDef);
    assertEquals(1, element.getChoices().size());
    assertSame(element, element.getChoices().iterator().next());
    assertEquals("elementsProperty2", element.getName());
    assertNull(element.getNamespace());
    assertNull(element.getRef());
    assertEquals(property.getPropertyType(), element.getAccessorType());
    assertEquals(KnownXmlType.DATE_TIME.getQname(), element.getBaseType().getQname());
    assertFalse(element.isNillable());
    assertFalse(element.isRequired());
    assertEquals(0, element.getMinOccurs());
    assertEquals("unbounded", element.getMaxOccurs());
View Full Code Here

  /**
   * Tests a single-choice collection property
   */
  public void testSingleChoiceCollectionProperty() throws Exception {
    ComplexTypeDefinition typeDef = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne"));
    PropertyDeclaration property = findProperty(typeDef, "elementsProperty1");
    Element element = new Element(property, typeDef);
    assertEquals(1, element.getChoices().size());
    assertSame(element, element.getChoices().iterator().next());
    assertEquals("item", element.getName());
    assertEquals("urn:item", element.getNamespace());
    assertNotNull(element.getRef());
    assertEquals(property.getPropertyType(), element.getAccessorType());
    assertEquals(KnownXmlType.ANY_TYPE.getQname(), element.getBaseType().getQname());
    assertFalse(element.isNillable());
    assertFalse(element.isRequired());
    assertEquals(0, element.getMinOccurs());
    assertEquals("unbounded", element.getMaxOccurs());
View Full Code Here

  /**
   * Tests a multi-choice collection property
   */
  public void testMultiChoiceCollectionProperty() throws Exception {
    ComplexTypeDefinition typeDef = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne"));
    PropertyDeclaration property = findProperty(typeDef, "elementsProperty3");
    Element element = new Element(property, typeDef);
    Collection<? extends Element> choices = element.getChoices();
    assertEquals(2, choices.size());
    for (Element choice : choices) {
      if ("durationItem".equals(choice.getName())) {
View Full Code Here

  /**
   * test a default wrapped element.
   */
  public void testDefaultWrappedElement() throws Exception {
    ComplexTypeDefinition typeDef = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ElementBeanOne"));
    PropertyDeclaration property = findProperty(typeDef, "wrappedElementsProperty2");
    Element element = new Element(property, typeDef);
    assertEquals(1, element.getChoices().size());
    assertSame(element, element.getChoices().iterator().next());
    assertEquals("wrappedElementsProperty2", element.getName());
    assertNull(element.getNamespace());
    assertNull(element.getRef());
    assertEquals(property.getPropertyType(), element.getAccessorType());
    assertEquals(KnownXmlType.INTEGER.getQname(), element.getBaseType().getQname());
    assertFalse(element.isNillable());
    assertFalse(element.isRequired());
    assertEquals(0, element.getMinOccurs());
    assertEquals("unbounded", element.getMaxOccurs());
View Full Code Here

TOP

Related Classes of net.sf.jelly.apt.decorations.declaration.PropertyDeclaration

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.