com.sun.xml.internal.bind.v2.schemagen.xmlschema.TypeHost Java Examples

The following examples show how to use com.sun.xml.internal.bind.v2.schemagen.xmlschema.TypeHost. 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: XmlSchemaGenerator.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes a type attribute (if the referenced type is a global type)
 * or writes out the definition of the anonymous type in place (if the referenced
 * type is not a global type.)
 *
 * Also provides processing for ID/IDREF, MTOM @xmime, and swa:ref
 *
 * ComplexTypeHost and SimpleTypeHost don't share an api for creating
 * and attribute in a type-safe way, so we will compromise for now and
 * use _attribute().
 */
private void writeTypeRef(TypeHost th, NonElementRef<T, C> typeRef, String refAttName) {
    // ID / IDREF handling
    switch(typeRef.getSource().id()) {
    case ID:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "ID"));
        return;
    case IDREF:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "IDREF"));
        return;
    case NONE:
        // no ID/IDREF, so continue on and generate the type
        break;
    default:
        throw new IllegalStateException();
    }

    // MTOM handling
    MimeType mimeType = typeRef.getSource().getExpectedMimeType();
    if( mimeType != null ) {
        th._attribute(new QName(WellKnownNamespace.XML_MIME_URI, "expectedContentTypes", "xmime"), mimeType.toString());
    }

    // ref:swaRef handling
    if(generateSwaRefAdapter(typeRef)) {
        th._attribute(refAttName, new QName(WellKnownNamespace.SWA_URI, "swaRef", "ref"));
        return;
    }

    // type name override
    if(typeRef.getSource().getSchemaType()!=null) {
        th._attribute(refAttName,typeRef.getSource().getSchemaType());
        return;
    }

    // normal type generation
    writeTypeRef(th, typeRef.getTarget(), refAttName);
}
 
Example #2
Source File: XmlSchemaGenerator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes a type attribute (if the referenced type is a global type)
 * or writes out the definition of the anonymous type in place (if the referenced
 * type is not a global type.)
 *
 * Also provides processing for ID/IDREF, MTOM @xmime, and swa:ref
 *
 * ComplexTypeHost and SimpleTypeHost don't share an api for creating
 * and attribute in a type-safe way, so we will compromise for now and
 * use _attribute().
 */
private void writeTypeRef(TypeHost th, NonElementRef<T, C> typeRef, String refAttName) {
    // ID / IDREF handling
    switch(typeRef.getSource().id()) {
    case ID:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "ID"));
        return;
    case IDREF:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "IDREF"));
        return;
    case NONE:
        // no ID/IDREF, so continue on and generate the type
        break;
    default:
        throw new IllegalStateException();
    }

    // MTOM handling
    MimeType mimeType = typeRef.getSource().getExpectedMimeType();
    if( mimeType != null ) {
        th._attribute(new QName(WellKnownNamespace.XML_MIME_URI, "expectedContentTypes", "xmime"), mimeType.toString());
    }

    // ref:swaRef handling
    if(generateSwaRefAdapter(typeRef)) {
        th._attribute(refAttName, new QName(WellKnownNamespace.SWA_URI, "swaRef", "ref"));
        return;
    }

    // type name override
    if(typeRef.getSource().getSchemaType()!=null) {
        th._attribute(refAttName,typeRef.getSource().getSchemaType());
        return;
    }

    // normal type generation
    writeTypeRef(th, typeRef.getTarget(), refAttName);
}
 
Example #3
Source File: XmlSchemaGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes a type attribute (if the referenced type is a global type)
 * or writes out the definition of the anonymous type in place (if the referenced
 * type is not a global type.)
 *
 * Also provides processing for ID/IDREF, MTOM @xmime, and swa:ref
 *
 * ComplexTypeHost and SimpleTypeHost don't share an api for creating
 * and attribute in a type-safe way, so we will compromise for now and
 * use _attribute().
 */
private void writeTypeRef(TypeHost th, NonElementRef<T, C> typeRef, String refAttName) {
    // ID / IDREF handling
    switch(typeRef.getSource().id()) {
    case ID:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "ID"));
        return;
    case IDREF:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "IDREF"));
        return;
    case NONE:
        // no ID/IDREF, so continue on and generate the type
        break;
    default:
        throw new IllegalStateException();
    }

    // MTOM handling
    MimeType mimeType = typeRef.getSource().getExpectedMimeType();
    if( mimeType != null ) {
        th._attribute(new QName(WellKnownNamespace.XML_MIME_URI, "expectedContentTypes", "xmime"), mimeType.toString());
    }

    // ref:swaRef handling
    if(generateSwaRefAdapter(typeRef)) {
        th._attribute(refAttName, new QName(WellKnownNamespace.SWA_URI, "swaRef", "ref"));
        return;
    }

    // type name override
    if(typeRef.getSource().getSchemaType()!=null) {
        th._attribute(refAttName,typeRef.getSource().getSchemaType());
        return;
    }

    // normal type generation
    writeTypeRef(th, typeRef.getTarget(), refAttName);
}
 
Example #4
Source File: XmlSchemaGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes a type attribute (if the referenced type is a global type)
 * or writes out the definition of the anonymous type in place (if the referenced
 * type is not a global type.)
 *
 * Also provides processing for ID/IDREF, MTOM @xmime, and swa:ref
 *
 * ComplexTypeHost and SimpleTypeHost don't share an api for creating
 * and attribute in a type-safe way, so we will compromise for now and
 * use _attribute().
 */
private void writeTypeRef(TypeHost th, NonElementRef<T, C> typeRef, String refAttName) {
    // ID / IDREF handling
    switch(typeRef.getSource().id()) {
    case ID:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "ID"));
        return;
    case IDREF:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "IDREF"));
        return;
    case NONE:
        // no ID/IDREF, so continue on and generate the type
        break;
    default:
        throw new IllegalStateException();
    }

    // MTOM handling
    MimeType mimeType = typeRef.getSource().getExpectedMimeType();
    if( mimeType != null ) {
        th._attribute(new QName(WellKnownNamespace.XML_MIME_URI, "expectedContentTypes", "xmime"), mimeType.toString());
    }

    // ref:swaRef handling
    if(generateSwaRefAdapter(typeRef)) {
        th._attribute(refAttName, new QName(WellKnownNamespace.SWA_URI, "swaRef", "ref"));
        return;
    }

    // type name override
    if(typeRef.getSource().getSchemaType()!=null) {
        th._attribute(refAttName,typeRef.getSource().getSchemaType());
        return;
    }

    // normal type generation
    writeTypeRef(th, typeRef.getTarget(), refAttName);
}
 
Example #5
Source File: XmlSchemaGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes a type attribute (if the referenced type is a global type)
 * or writes out the definition of the anonymous type in place (if the referenced
 * type is not a global type.)
 *
 * Also provides processing for ID/IDREF, MTOM @xmime, and swa:ref
 *
 * ComplexTypeHost and SimpleTypeHost don't share an api for creating
 * and attribute in a type-safe way, so we will compromise for now and
 * use _attribute().
 */
private void writeTypeRef(TypeHost th, NonElementRef<T, C> typeRef, String refAttName) {
    // ID / IDREF handling
    switch(typeRef.getSource().id()) {
    case ID:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "ID"));
        return;
    case IDREF:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "IDREF"));
        return;
    case NONE:
        // no ID/IDREF, so continue on and generate the type
        break;
    default:
        throw new IllegalStateException();
    }

    // MTOM handling
    MimeType mimeType = typeRef.getSource().getExpectedMimeType();
    if( mimeType != null ) {
        th._attribute(new QName(WellKnownNamespace.XML_MIME_URI, "expectedContentTypes", "xmime"), mimeType.toString());
    }

    // ref:swaRef handling
    if(generateSwaRefAdapter(typeRef)) {
        th._attribute(refAttName, new QName(WellKnownNamespace.SWA_URI, "swaRef", "ref"));
        return;
    }

    // type name override
    if(typeRef.getSource().getSchemaType()!=null) {
        th._attribute(refAttName,typeRef.getSource().getSchemaType());
        return;
    }

    // normal type generation
    writeTypeRef(th, typeRef.getTarget(), refAttName);
}
 
Example #6
Source File: XmlSchemaGenerator.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes a type attribute (if the referenced type is a global type)
 * or writes out the definition of the anonymous type in place (if the referenced
 * type is not a global type.)
 *
 * Also provides processing for ID/IDREF, MTOM @xmime, and swa:ref
 *
 * ComplexTypeHost and SimpleTypeHost don't share an api for creating
 * and attribute in a type-safe way, so we will compromise for now and
 * use _attribute().
 */
private void writeTypeRef(TypeHost th, NonElementRef<T, C> typeRef, String refAttName) {
    // ID / IDREF handling
    switch(typeRef.getSource().id()) {
    case ID:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "ID"));
        return;
    case IDREF:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "IDREF"));
        return;
    case NONE:
        // no ID/IDREF, so continue on and generate the type
        break;
    default:
        throw new IllegalStateException();
    }

    // MTOM handling
    MimeType mimeType = typeRef.getSource().getExpectedMimeType();
    if( mimeType != null ) {
        th._attribute(new QName(WellKnownNamespace.XML_MIME_URI, "expectedContentTypes", "xmime"), mimeType.toString());
    }

    // ref:swaRef handling
    if(generateSwaRefAdapter(typeRef)) {
        th._attribute(refAttName, new QName(WellKnownNamespace.SWA_URI, "swaRef", "ref"));
        return;
    }

    // type name override
    if(typeRef.getSource().getSchemaType()!=null) {
        th._attribute(refAttName,typeRef.getSource().getSchemaType());
        return;
    }

    // normal type generation
    writeTypeRef(th, typeRef.getTarget(), refAttName);
}
 
Example #7
Source File: XmlSchemaGenerator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes a type attribute (if the referenced type is a global type)
 * or writes out the definition of the anonymous type in place (if the referenced
 * type is not a global type.)
 *
 * Also provides processing for ID/IDREF, MTOM @xmime, and swa:ref
 *
 * ComplexTypeHost and SimpleTypeHost don't share an api for creating
 * and attribute in a type-safe way, so we will compromise for now and
 * use _attribute().
 */
private void writeTypeRef(TypeHost th, NonElementRef<T, C> typeRef, String refAttName) {
    // ID / IDREF handling
    switch(typeRef.getSource().id()) {
    case ID:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "ID"));
        return;
    case IDREF:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "IDREF"));
        return;
    case NONE:
        // no ID/IDREF, so continue on and generate the type
        break;
    default:
        throw new IllegalStateException();
    }

    // MTOM handling
    MimeType mimeType = typeRef.getSource().getExpectedMimeType();
    if( mimeType != null ) {
        th._attribute(new QName(WellKnownNamespace.XML_MIME_URI, "expectedContentTypes", "xmime"), mimeType.toString());
    }

    // ref:swaRef handling
    if(generateSwaRefAdapter(typeRef)) {
        th._attribute(refAttName, new QName(WellKnownNamespace.SWA_URI, "swaRef", "ref"));
        return;
    }

    // type name override
    if(typeRef.getSource().getSchemaType()!=null) {
        th._attribute(refAttName,typeRef.getSource().getSchemaType());
        return;
    }

    // normal type generation
    writeTypeRef(th, typeRef.getTarget(), refAttName);
}
 
Example #8
Source File: XmlSchemaGenerator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes a type attribute (if the referenced type is a global type)
 * or writes out the definition of the anonymous type in place (if the referenced
 * type is not a global type.)
 *
 * Also provides processing for ID/IDREF, MTOM @xmime, and swa:ref
 *
 * ComplexTypeHost and SimpleTypeHost don't share an api for creating
 * and attribute in a type-safe way, so we will compromise for now and
 * use _attribute().
 */
private void writeTypeRef(TypeHost th, NonElementRef<T, C> typeRef, String refAttName) {
    // ID / IDREF handling
    switch(typeRef.getSource().id()) {
    case ID:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "ID"));
        return;
    case IDREF:
        th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "IDREF"));
        return;
    case NONE:
        // no ID/IDREF, so continue on and generate the type
        break;
    default:
        throw new IllegalStateException();
    }

    // MTOM handling
    MimeType mimeType = typeRef.getSource().getExpectedMimeType();
    if( mimeType != null ) {
        th._attribute(new QName(WellKnownNamespace.XML_MIME_URI, "expectedContentTypes", "xmime"), mimeType.toString());
    }

    // ref:swaRef handling
    if(generateSwaRefAdapter(typeRef)) {
        th._attribute(refAttName, new QName(WellKnownNamespace.SWA_URI, "swaRef", "ref"));
        return;
    }

    // type name override
    if(typeRef.getSource().getSchemaType()!=null) {
        th._attribute(refAttName,typeRef.getSource().getSchemaType());
        return;
    }

    // normal type generation
    writeTypeRef(th, typeRef.getTarget(), refAttName);
}