/******************************************************************************* * Copyright (c) 2010-2014 SAP AG 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 * * Contributors: * SAP AG - initial API and implementation *******************************************************************************/ package org.eclipse.skalli.core.xstream; import com.thoughtworks.xstream.converters.Converter; import com.thoughtworks.xstream.converters.MarshallingContext; import com.thoughtworks.xstream.converters.UnmarshallingContext; import com.thoughtworks.xstream.io.HierarchicalStreamReader; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; /** * Converter for skipping unknown tags when unmarshaling entities or configurations. * Be careful using this converter to unmarshal entries of collections that cannot * handle <code>null</code> pointers, like for example <code>TreeSet</code>. */ public class NoopConverter implements Converter { @Override public boolean canConvert(@SuppressWarnings("rawtypes") Class type) { return type.equals(Noop.class); } /** * This method does nothing. */ @Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext contex) { } /** * This method always returns <code>null</code>. */ @Override public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { return null; } }