Search in sources :

Example 1 with GO_CharacterString

use of org.apache.sis.internal.jaxb.gco.GO_CharacterString in project sis by apache.

the class MimeFileTypeAdapter method marshal.

/**
 * Converts a MIME type to the object to be marshalled in a XML file or stream.
 * JAXB calls automatically this method at marshalling time.
 *
 * @param  value  the MIME type, or {@code null}.
 * @return the wrapper for the given MIME type, or {@code null}.
 */
@Override
public GO_CharacterString marshal(final String value) {
    final Context context = Context.current();
    final GO_CharacterString wrapper = CharSequenceAdapter.wrap(context, value, value);
    if (wrapper != null && wrapper.type == 0) {
        if (!Context.isFlagSet(context, Context.SUBSTITUTE_MIMETYPE)) {
            wrapper.type = GO_CharacterString.MIME_TYPE;
        }
        return wrapper;
    }
    return null;
}
Also used : Context(org.apache.sis.internal.jaxb.Context) GO_CharacterString(org.apache.sis.internal.jaxb.gco.GO_CharacterString)

Aggregations

Context (org.apache.sis.internal.jaxb.Context)1 GO_CharacterString (org.apache.sis.internal.jaxb.gco.GO_CharacterString)1