1 //
2 // ========================================================================
3 // Copyright (c) 1995-2015 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 org.eclipse.jetty.websocket.jsr356.MessageType;
22
23 /**
24 * The immutable base metadata for a coder ({@link javax.websocket.Decoder} or {@link javax.websocket.Encoder}
25 *
26 * @param <T>
27 * the specific type of coder ({@link javax.websocket.Decoder} or {@link javax.websocket.Encoder}
28 */
29 public abstract class CoderMetadata<T>
30 {
31 /** The class for the Coder */
32 private final Class<? extends T> coderClass;
33 /** The Class that the Decoder declares it decodes */
34 private final Class<?> objType;
35 /** The Basic type of message the decoder handles */
36 private final MessageType messageType;
37 /** Flag indicating if Decoder is for streaming (or not) */
38 private final boolean streamed;
39
40 public CoderMetadata(Class<? extends T> coderClass, Class<?> objType, MessageType messageType, boolean streamed)
41 {
42 this.objType = objType;
43 this.coderClass = coderClass;
44 this.messageType = messageType;
45 this.streamed = streamed;
46 }
47
48 public Class<? extends T> getCoderClass()
49 {
50 return this.coderClass;
51 }
52
53 public MessageType getMessageType()
54 {
55 return messageType;
56 }
57
58 public Class<?> getObjectType()
59 {
60 return objType;
61 }
62
63 public boolean isStreamed()
64 {
65 return streamed;
66 }
67 }