Package juzu.impl.bridge.response

Source Code of juzu.impl.bridge.response.FooWriter

package juzu.impl.bridge.response;

import juzu.impl.request.EntityMarshaller;
import juzu.io.Chunk;
import juzu.io.ChunkBuffer;
import juzu.io.Streamable;

import java.lang.reflect.AnnotatedElement;

/**
* @author Julien Viet
*/
public class FooWriter extends EntityMarshaller {

  @Override
  public Streamable marshall(String mimeType, AnnotatedElement annotations, Object object) {
    if (mimeType.equals("text/foo") && object instanceof Foo) {
      Foo foo = (Foo)object;
      return new ChunkBuffer().append(Chunk.create(foo.data));
    } else{
      return null;
    }
  }
}
TOP

Related Classes of juzu.impl.bridge.response.FooWriter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.