/* * Copyright (c) 2017 Pantheon Technologies, s.r.o. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.yangtools.yang.data.codec.xml; import javax.xml.namespace.NamespaceContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; final class NullXmlCodec implements XmlCodec { static final NullXmlCodec INSTANCE = new NullXmlCodec(); private static final Logger LOG = LoggerFactory.getLogger(NullXmlCodec.class); private NullXmlCodec() { } @Override public Class getDataClass() { return Object.class; } @Override public void serializeToWriter(final XMLStreamWriter writer, final Object value) throws XMLStreamException { // NOOP since codec is unkwown. LOG.warn("Call of the serializeToWriter method on null codec. No operation performed."); } @Override public Object deserializeFromString(final NamespaceContext namespaceContext, final String value) { LOG.warn("Call of the deserializeString method on null codec. No operation performed."); return null; } }