Example usage for javax.xml.bind.annotation XmlType toString

List of usage examples for javax.xml.bind.annotation XmlType toString

Introduction

In this page you can find the example usage for javax.xml.bind.annotation XmlType toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.legstar.coxb.impl.reflect.CComplexReflectBinding.java

/**
 * Helper method. JAXB Types are annotated with an XmlType which gives an
 * ordered list of properties// www.  j  a v  a 2 s  .com
 * 
 * @param jaxbType the JAXB Class with annotations
 * @param jaxbObjectFactory the JAXB object factory
 * @throws ReflectBindingException if initialization fails
 */
private void initComplexElement(final Class<?> jaxbType, final Object jaxbObjectFactory)
        throws ReflectBindingException {

    if (_log.isDebugEnabled()) {
        _log.debug("Initializing Complex binding for " + jaxbType);
    }
    XmlType xmlType = (XmlType) jaxbType.getAnnotation(XmlType.class);
    if (xmlType == null) {
        throw new ReflectBindingException("No jaxb annotations found in " + jaxbType);
    }
    if (_log.isDebugEnabled()) {
        _log.debug("Found JAXB annotations: " + xmlType.toString());
    }

    /* Assume we are bound to a JAXB object */
    setValueObjectClassName(jaxbType.getName());
    setValueObjectsFactoryClassName(jaxbObjectFactory.getClass().getName());

    /*
     * Jaxb class might hold an annotation which gives more details on how
     * to bind
     */
    CobolComplexType cobolComplexType = (CobolComplexType) jaxbType.getAnnotation(CobolComplexType.class);
    if (cobolComplexType != null && cobolComplexType.javaClassName() != null
            && cobolComplexType.javaClassName().length() > 0) {
        setValueObjectClassName(cobolComplexType.javaClassName());
        /*
         * TODO allow more options, such as factory name, to be passed as
         * annotations
         */
        setValueObjectsFactoryClassName(null);
    }

    initChildren(jaxbType, xmlType);

    if (_log.isDebugEnabled()) {
        _log.debug("Complex binding sucessfully initialized for: " + jaxbType);
    }
}