1 //
2 // ========================================================================
3 // Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
8 //
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
11 //
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
14 //
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
17 //
18
19 package org.eclipse.jetty.websocket.jsr356.metadata;
20
21 import javax.websocket.Decoder;
22 import javax.websocket.Encoder;
23
24 import org.eclipse.jetty.websocket.jsr356.MessageType;
25
26 /**
27 * The immutable base metadata for a coder ({@link Decoder} or {@link Encoder}
28 *
29 * @param <T>
30 * the specific type of coder ({@link Decoder} or {@link Encoder}
31 */
32 public abstract class CoderMetadata<T>
33 {
34 /** The class for the Coder */
35 private final Class<? extends T> coderClass;
36 /** The Class that the Decoder declares it decodes */
37 private final Class<?> objType;
38 /** The Basic type of message the decoder handles */
39 private final MessageType messageType;
40 /** Flag indicating if Decoder is for streaming (or not) */
41 private final boolean streamed;
42
43 public CoderMetadata(Class<? extends T> coderClass, Class<?> objType, MessageType messageType, boolean streamed)
44 {
45 this.objType = objType;
46 this.coderClass = coderClass;
47 this.messageType = messageType;
48 this.streamed = streamed;
49 }
50
51 public Class<? extends T> getCoderClass()
52 {
53 return this.coderClass;
54 }
55
56 public MessageType getMessageType()
57 {
58 return messageType;
59 }
60
61 public Class<?> getObjectType()
62 {
63 return objType;
64 }
65
66 public boolean isStreamed()
67 {
68 return streamed;
69 }
70 }