OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
TypeSupport.java
Go to the documentation of this file.
1 /* Copyright 2010, Object Management Group, Inc.
2  * Copyright 2010, PrismTech, Inc.
3  * Copyright 2010, Real-Time Innovations, Inc.
4  * All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 package org.omg.dds.type;
20 
21 import org.omg.dds.core.DDSObject;
23 
24 
33 public abstract class TypeSupport<TYPE> implements DDSObject
34 {
35  // -----------------------------------------------------------------------
36  // Factory Methods
37  // -----------------------------------------------------------------------
38 
39  // --- Types: ------------------------------------------------------------
40 
49  public static <TYPE> TypeSupport<TYPE> newTypeSupport(
50  Class<TYPE> type,
52  {
53  if (type == null) {
54  throw new IllegalArgumentException("Invalid type provided");
55  }
56  return newTypeSupport(type, type.getName(), env);
57  }
58 
59 
87  public static <TYPE> TypeSupport<TYPE> newTypeSupport(
88  Class<TYPE> type,
89  String registeredName,
91  {
92  if (env == null) {
93  throw new IllegalArgumentException("Invalid environment provided");
94  }
95  if (type == null) {
96  throw new IllegalArgumentException("Invalid type provided");
97  }
98  return env.getSPI().newTypeSupport(type, registeredName);
99  }
100 
101 
102 
103  // -----------------------------------------------------------------------
104  // Instance Methods
105  // -----------------------------------------------------------------------
106 
110  public abstract TYPE newData();
111 
115  public abstract Class<TYPE> getType();
116 
121  public abstract String getTypeName();
122 }
abstract Class< TYPE > getType()
abstract ServiceProviderInterface getSPI()
This method is not intended for use by applications.
public< TYPE > TypeSupport< TYPE > newTypeSupport(Class< TYPE > type, String registeredName)
Create a new org.omg.dds.type.TypeSupport object for the given physical type.
static< TYPE > TypeSupport< TYPE > newTypeSupport(Class< TYPE > type, ServiceEnvironment env)
Create a new TypeSupport object for the given physical type.
abstract String getTypeName()
A supertype of all DDS classes and interfaces.
Definition: DDSObject.java:25
TypeSupport is an abstract interface that has to be specialized for each concrete type that will be u...
static< TYPE > TypeSupport< TYPE > newTypeSupport(Class< TYPE > type, String registeredName, ServiceEnvironment env)
Create a new TypeSupport object for the given physical type.
DDS implementations are rooted in this class, a concrete subclass of which can be instantiated based ...