All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.legaldocml.akn.other.UnsupportedModule Maven / Gradle / Ivy

The newest version!
package io.legaldocml.akn.other;

import io.legaldocml.akn.AknObject;
import io.legaldocml.io.Attribute;
import io.legaldocml.util.CharArray;
import io.legaldocml.io.XmlWriter;
import io.legaldocml.io.impl.Buffers;
import io.legaldocml.module.Module;

import java.io.IOException;
import java.util.function.Supplier;

/**
 * @author Jacques Militello
 */
public final class UnsupportedModule implements Module {

    private final String prefix;
    private final CharArray uri;

    public UnsupportedModule(CharArray prefix, CharArray uri) {
        this.prefix = prefix.toString();
        this.uri = uri;
    }


    @Override
    public CharArray namespace() {
        return this.uri;
    }

    @Override
    public void writeNamespace(XmlWriter writer) throws IOException {
        StringBuilder prefix = new StringBuilder()
                .append("xmlns:")
                .append(this.prefix);
        writer.writeNamespace(Buffers.address(prefix.toString()), prefix.length(), Buffers.address(uri.toString()), uri.length());
    }

    @Override
    public Supplier attributes(String name) {
        return null;
    }

    @SuppressWarnings("unchecked")
    @Override
    public  Supplier element(String localName, Class clazz) {
        return () -> (T) new SimpleExternalElement(prefix, localName);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Class getAknClass(String localName) {
        // TODO....
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy