Example usage for javax.xml.bind.annotation XmlAccessType NONE

List of usage examples for javax.xml.bind.annotation XmlAccessType NONE

Introduction

In this page you can find the example usage for javax.xml.bind.annotation XmlAccessType NONE.

Prototype

XmlAccessType NONE

To view the source code for javax.xml.bind.annotation XmlAccessType NONE.

Click Source Link

Document

None of the fields or properties is bound to XML unless they are specifically annotated with some of the JAXB annotations.

Usage

From source file:org.javelin.sws.ext.bind.internal.model.AnalyzeSimpleTypesTest.java

@Test
public void analyzeBuiltInDatatype() throws Exception {
    TypedPatternRegistry context = (TypedPatternRegistry) SweJaxbContextFactory.createContext("", null);

    PropertyCallback<String> pc = new PropertyCallback<String>(context, String.class,
            SweJaxbConstants.XSD_STRING, XmlAccessType.NONE, XmlNsForm.QUALIFIED, XmlNsForm.UNQUALIFIED);
    TypedPattern<String> pattern = pc.analyze();
    assertTrue(pattern.isSimpleType());//  w  w  w  .  j a  v a2  s  .c  o  m
    assertThat(pattern.getJavaType(), equalTo(String.class));
    assertThat(pattern.getSchemaType(), equalTo(new QName(Constants.URI_2001_SCHEMA_XSD, "string")));

    @SuppressWarnings("unchecked")
    Map<Class<?>, TypedPattern<?>> patterns = (Map<Class<?>, TypedPattern<?>>) ReflectionTestUtils
            .getField(context, "patterns");
    TypedPattern<?> pattern2 = patterns.get(String.class);

    assertSame("Primitive and built-in types should be analyzed only at context creation time.", pattern,
            pattern2);
}

From source file:org.castor.jaxb.reflection.ClassAnnotationProcessingServiceTest.java

@Test
public void testProcessAnnotationsWithXmlAccessorTypeNONEAnnotation() {
    Class<WithXmlAccessorTypeAnnotationNONE> clazz = WithXmlAccessorTypeAnnotationNONE.class;
    Annotation[] annotations = clazz.getAnnotations();
    JaxbClassNature classInfo = new JaxbClassNature(
            new ClassInfo(WithXmlAccessorTypeAnnotationNONE.class.getName()));
    classAnnotationProcessingService.processAnnotations(classInfo, annotations);

    // XmlRootElement annotations
    Assert.assertNull(classInfo.getRootElementName());
    Assert.assertNull(classInfo.getRootElementNamespace());
    // XmlType annotation
    Assert.assertNull(classInfo.getTypeFactoryClass());
    Assert.assertNull(classInfo.getTypeFactoryMethod());
    Assert.assertNull(classInfo.getTypeName());
    Assert.assertNull(classInfo.getTypeNamespace());
    Assert.assertNull(classInfo.getTypeProperties());
    // XmlTransient annotation
    Assert.assertFalse(classInfo.getXmlTransient());
    // XmlSeeAlso annotation
    Assert.assertNull(classInfo.getSeeAlsoClasses());
    // XmlAccessorOrder annotations
    Assert.assertNull(classInfo.getXmlAccessOrder());
    // XmlAccessorType annotations
    Assert.assertEquals(XmlAccessType.NONE, classInfo.getXmlAccessType());
}