blob: 86791063c07401a56a8bb862a949a2c8c0319f95 [file] [log] [blame]
/*
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.glassfish.jaxb.runtime.v2.runtime;
import com.sun.istack.NotNull;
import org.glassfish.jaxb.runtime.api.AccessorException;
import org.xml.sax.SAXException;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import java.io.IOException;
/**
* {@link Transducer} that delegates to another {@link Transducer}.
*
* @author Kohsuke Kawaguchi
*/
public abstract class FilterTransducer<T> implements Transducer<T> {
protected final Transducer<T> core;
protected FilterTransducer(Transducer<T> core) {
this.core = core;
}
@Override
public boolean useNamespace() {
return core.useNamespace();
}
@Override
public void declareNamespace(T o, XMLSerializer w) throws AccessorException {
core.declareNamespace(o, w);
}
@Override
public @NotNull CharSequence print(@NotNull T o) throws AccessorException {
return core.print(o);
}
@Override
public T parse(CharSequence lexical) throws AccessorException, SAXException {
return core.parse(lexical);
}
@Override
public void writeText(XMLSerializer w, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException {
core.writeText(w, o, fieldName);
}
@Override
public void writeLeafElement(XMLSerializer w, Name tagName, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException {
core.writeLeafElement(w,tagName,o,fieldName);
}
@Override
public QName getTypeName(T instance) {
return null;
}
}