Package org.apache.sis.internal.jaxb

Examples of org.apache.sis.internal.jaxb.Context


    /**
     * Delegates the unmarshalling to the wrapped unmarshaller.
     */
    @Override
    public Object unmarshal(final XMLEventReader input) throws JAXBException {
        final Context context = begin();
        try {
            return unmarshaller.unmarshal(input);
        } finally {
            context.finish();
        }
    }
View Full Code Here


    /**
     * Delegates the unmarshalling to the wrapped unmarshaller.
     */
    @Override
    public <T> JAXBElement<T> unmarshal(final XMLEventReader input, final Class<T> declaredType) throws JAXBException {
        final Context context = begin();
        try {
            return unmarshaller.unmarshal(input, declaredType);
        } finally {
            context.finish();
        }
    }
View Full Code Here

     * }
     *
     * @see Context#finish();
     */
    final Context begin() {
        return new Context(bitMasks, locale, timezone, schemas, gmlVersion, resolver, converter, warningListener);
    }
View Full Code Here

            final IdentifierMap map = ((IdentifiedObject) metadata).getIdentifierMap();
            XLink  link = map.getSpecialized(IdentifierSpace.XLINK);
            UUID   uuid = map.getSpecialized(IdentifierSpace.UUID);
            String anyUUID = (uuid != null) ? uuid.toString() : map.get(IdentifierSpace.UUID);
            if (anyUUID != null || link != null) {
                final Context           context  = Context.current();
                final ReferenceResolver resolver = Context.resolver(context);
                final Class<BoundType>  type     = getBoundType();
                if (uuid == null) {
                    uuid = ObjectReference.toUUID(context, anyUUID); // May still null.
                }
View Full Code Here

    /**
     * Parses the given URI, or returns {@code null} if the given argument is null or empty.
     */
    private static URI toURI(final String uri) throws URISyntaxException {
        final Context context = Context.current();
        return Context.converter(context).toURI(context, uri);
    }
View Full Code Here

     * @throws IllegalArgumentException if the given symbol is unknown.
     */
    @Override
    public Unit<?> unmarshal(String value) throws IllegalArgumentException {
        if (value != null) {
            final Context context = Context.current();
            return Context.converter(context).toUnit(context, value);
        }
        return null;
    }
View Full Code Here

     * @param date The date to marshal. Can not be {@code null}.
     * @param allowTime {@code true} for allowing the usage of {@code "DateTime"} field if
     *        applicable, or {@code false} for using the {@code "Date"} field in every cases.
     */
    GO_DateTime(final XmlAdapter<GO_DateTime,?> source, final Date date, final boolean allowTime) {
        final Context context = Context.current();
        try {
            final XMLGregorianCalendar gc = XmlUtilities.toXML(context, date);
            if (XmlUtilities.trimTime(gc, !allowTime)) {
                this.date = gc;
            } else {
View Full Code Here

    static String toString(final CharSequence text) {
        if (text == null) {
            return null;
        }
        if (text instanceof InternationalString) {
            final Context context = Context.current();
            if (context != null) {
                final Locale locale = context.getLocale();
                if (locale != null) {
                    // While Apache SIS accepts null locale, foreigner
                    // implementations are not guaranteed to support null.
                    return ((InternationalString) text).toString(locale);
                }
View Full Code Here

        /*
         * Try to guess if the UOM is a URN or URL. We looks for character that are usually
         * part of URI but not part of unit symbols, for example ':'. We can not search for
         * '/' and '.' since they are part of UCUM representation.
         */
        final Context context = Context.current();
        final ValueConverter converter = Context.converter(context);
        if (uom.indexOf(':') >= 0) {
            final URI uri = converter.toURI(context, uom);
            String part = uri.getFragment();
            if (part != null) {
View Full Code Here

     */
    @Override
    public URI unmarshal(final GO_CharacterString value) throws URISyntaxException {
        final String text = StringAdapter.toString(value);
        if (text != null) {
            final Context context = Context.current();
            return Context.converter(context).toURI(context, text);
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.sis.internal.jaxb.Context

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.