/*
* Copyright 2009-2010 the original author or authors.
*
* Licensed under the Apache license, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.internna.iwebmvc.dwr;
import org.directwebremoting.ConversionException;
import org.directwebremoting.extend.Converter;
import org.directwebremoting.extend.ConverterManager;
import org.directwebremoting.extend.InboundVariable;
import org.directwebremoting.extend.NonNestedOutboundVariable;
import org.directwebremoting.extend.OutboundContext;
import org.directwebremoting.extend.OutboundVariable;
/**
* Null inbound converter useful for interfaces. Better than DWR counterpart as
* it will be referenced as a singleton.
*
* @author Jose Noheda
* @since 2.0
*/
public class NullConverter implements Converter {
/**
* No operation.
*
* @param arg0 any (unused)
*/
@Override public void setConverterManager(ConverterManager arg0) {
return;
}
/**
* Returns null.
*
* @param arg0 any (unused)
* @param arg1 any (unused)
* @return null
* @throws ConversionException never
*/
@Override public Object convertInbound(Class<?> arg0, InboundVariable arg1) throws ConversionException {
return null;
}
/**
* Returns a null js string.
*
* @param arg0 any (unused)
* @param arg1 any (unused)
* @return
* @throws ConversionException never
*/
@Override public OutboundVariable convertOutbound(Object arg0, OutboundContext arg1) throws ConversionException {
return new NonNestedOutboundVariable("null");
}
}