Class EventStreamRPCServiceModel
- java.lang.Object
-
- software.amazon.awssdk.eventstreamrpc.EventStreamRPCServiceModel
-
- Direct Known Subclasses:
GreengrassCoreIPCServiceModel
public abstract class EventStreamRPCServiceModel extends Object
Implementers of this service model are expected to likely be singletons. There should be little value to having more than one, though between different instances properly constructed for a service, they can be used interchangeably
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTENT_TYPE_APPLICATION_JSON
Content type application json stringstatic String
CONTENT_TYPE_APPLICATION_TEXT
Content type application text stringstatic String
CONTENT_TYPE_HEADER
Content type header stringstatic String
SERVICE_MODEL_TYPE_HEADER
Service model type header
-
Constructor Summary
Constructors Constructor Description EventStreamRPCServiceModel()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static boolean
blobTypeEquals(Optional<byte[]> lhs, Optional<byte[]> rhs)
Used to compare two members of a blob shape for equality.<T extends EventStreamJsonMessage>
TfromJson(Class<T> clazz, byte[] payload)
Creates a EventStreamJsonMessage of type T from the given application model class and payload.EventStreamJsonMessage
fromJson(String applicationModelType, byte[] payload)
Creates a EventStreamJsonMessage from the given application model type string and payload.abstract Collection<String>
getAllOperations()
Retreives all operations on the serviceOptional<Class<? extends EventStreamJsonMessage>>
getApplicationModelClass(String applicationModelType)
Returns the application model classabstract OperationModelContext
getOperationModelContext(String operationName)
Retrieves the operation model context for a given operation name on the service This may not be a useful interface as generated code will typically pull a known operation model context Public visibility is useful for testingabstract String
getServiceName()
For getting the actual service namestatic com.google.gson.Gson
getStaticGson()
In situations where the framework needs to do some JSON processing without a specific service/operation in contextbyte[]
toJson(EventStreamJsonMessage message)
String
toJsonString(EventStreamJsonMessage message)
Converts the given EventStreamJsonMessage to a JSON string
-
-
-
Field Detail
-
CONTENT_TYPE_HEADER
public static final String CONTENT_TYPE_HEADER
Content type header string- See Also:
- Constant Field Values
-
CONTENT_TYPE_APPLICATION_TEXT
public static final String CONTENT_TYPE_APPLICATION_TEXT
Content type application text string- See Also:
- Constant Field Values
-
CONTENT_TYPE_APPLICATION_JSON
public static final String CONTENT_TYPE_APPLICATION_JSON
Content type application json string- See Also:
- Constant Field Values
-
SERVICE_MODEL_TYPE_HEADER
public static final String SERVICE_MODEL_TYPE_HEADER
Service model type header- See Also:
- Constant Field Values
-
-
Method Detail
-
blobTypeEquals
public static boolean blobTypeEquals(Optional<byte[]> lhs, Optional<byte[]> rhs)
Used to compare two members of a blob shape for equality. Array equals nesting inside of an Optional doesn't work Note: Generated code for equals method of Smithy shapes relies on this- Parameters:
lhs
- The first to comparerhs
- The second to compare- Returns:
- True if both are equal, false otherwise
-
getServiceName
public abstract String getServiceName()
For getting the actual service name- Returns:
- The name of the service as a string
-
getApplicationModelClass
public final Optional<Class<? extends EventStreamJsonMessage>> getApplicationModelClass(String applicationModelType)
Returns the application model class- Parameters:
applicationModelType
- The application model- Returns:
- The class of the given application model
-
getAllOperations
public abstract Collection<String> getAllOperations()
Retreives all operations on the service- Returns:
- All operations on the service
-
getOperationModelContext
public abstract OperationModelContext getOperationModelContext(String operationName)
Retrieves the operation model context for a given operation name on the service This may not be a useful interface as generated code will typically pull a known operation model context Public visibility is useful for testing- Parameters:
operationName
- The name of the operation- Returns:
- The operation context associated with the given operation name
-
toJson
public byte[] toJson(EventStreamJsonMessage message)
-
toJsonString
public String toJsonString(EventStreamJsonMessage message)
Converts the given EventStreamJsonMessage to a JSON string- Parameters:
message
- The message to convert- Returns:
- A JSON string
-
getStaticGson
public static com.google.gson.Gson getStaticGson()
In situations where the framework needs to do some JSON processing without a specific service/operation in context- Returns:
- the static Gson instance capable of processing the basics of EventStreamableJsonMessage
-
fromJson
public EventStreamJsonMessage fromJson(String applicationModelType, byte[] payload)
Creates a EventStreamJsonMessage from the given application model type string and payload. Uses this service's specific model class to create the EventStreamJsonMessage.- Parameters:
applicationModelType
- The application model type stringpayload
- The payload- Returns:
- A EventStreamMessage
-
fromJson
public <T extends EventStreamJsonMessage> T fromJson(Class<T> clazz, byte[] payload)
Creates a EventStreamJsonMessage of type T from the given application model class and payload.- Type Parameters:
T
- The type to convert the result to- Parameters:
clazz
- The classpayload
- The payload- Returns:
- A EventStreamMessage of type T
-
-