All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.primefaces.push.Encoder Maven / Gradle / Ivy

There is a newer version: 14.0.0-RC2
Show newest version
/*
 * 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;

/**
 * Encode a message returned by a method annotated with {@link org.primefaces.push.annotation.OnMessage}
 * annotated class. The encoded object will be written back to the client. For example
 *
 * 

     public final static class StringBufferEncoder implements Encoder>StringBuffer, String<  {

         @Override
         public String encode(StringBuffer s) {
             return s.toString() + "-yo!";
         }
     }
 * 
* will encode a StringBuffer into a String. The StringBuffer will be the object returned when a method annotated with @Message is invoked *

     @Message(encoders = {StringBufferEncoder.class})
     public StringBuffer encode(String m) {
         return new StringBuffer(m);
     }
 * 
* You can chain Encoders by defining more than one. They will be invoked in the order they have been added and the last Encoder's value * will be used for the write operation. * @param * @param */ public interface Encoder extends org.atmosphere.config.managed.Encoder{ // Atmosphere Proxy /** * Encode the object of type U into an object of type T. * @param s an object that has already been encoded or returned from an @Message annotated class. * @return an encoded object. */ //@Override T encode(U s); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy