/* * Copyright 2009-2014 PrimeTek. * * 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.primefaces.push; /** * Decode a message in order to invoke a class annotated with {@link org.primefaces.push.annotation.PushEndpoint} with a method * annotated with {@link org.primefaces.push.annotation.OnMessage}. For example: * <blockquote><pre> public final class StringBufferDecoder implements Decoder<String, StringBuffer> { @Override public StringBuffer decode(String s) { return new StringBuffer(s); } } * </pre></blockquote> * will decode a String into a StringBuffer. The decoded object will then be used to invoke a method annotated with @Message * <blockquote><pre> @Message(decoders = {StringBufferDecoder.class}) public void message(StringBuffer m) { message.set(m.toString()); } * </pre></blockquote> * You can chain Decoders. They will be invoked in the order they are defined and the last decoded value will be used to invoke the * @Message annotated method. * @param <U> * @param <T> */ public interface Decoder<U, T> extends org.atmosphere.config.managed.Decoder<U, T>{ // Atmosphere Proxy /** * Decode the specified object of type U into object of type T * * @param s a object of type U * @return a new object of type T */ //@Override T decode(U s); }