Class Unpack
- java.lang.Object
-
- org.hansken.plugin.extraction.runtime.grpc.common.Unpack
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends com.google.protobuf.Message>
Tany(com.google.protobuf.Any any, Class<T> messageType)Upack anAnycontaining a message of given message type.static Authorauthor(RpcAuthor author)static byte[]bytes(com.google.protobuf.Any any)Convert primitiveRpcBytesmessage to the native Javabyte[]counterpart.static RpcFinishfinish(com.google.protobuf.Any any)Unpack anAnycontaining anRpcFinishmessage.static MaturityLevelmaturityLevel(RpcMaturity maturity)Convert givenRpcMaturityto theirMaturityLevelcounterpart.static StringpluginApiVersion(RpcPluginInfo rpcPluginInfo)Returns the API version contained in theRpcPluginInfoinstance.static PluginIdpluginId(RpcPluginIdentifier rpcPluginIdentifier)static PluginInfopluginInfo(RpcPluginInfo rpcPluginInfo)Convert givenRpcPluginInfoto theirPluginInfocounterpart.static PluginResourcespluginResources(RpcPluginResources rpcPluginResources)Convert givenRpcPluginResourcesto theirPluginResourcescounterpart.static PluginTypepluginType(RpcPluginType type)Convert givenRpcPluginTypeto theirPluginTypecounterpart.static Objectprimitive(com.google.protobuf.Any any)Convert given primitive message to their native Java counterpart.static TraceSearcher.SearchScopesearchScope(RpcSearchScope scope)static RpcStartstart(com.google.protobuf.Any any)Unpack anAnycontaining anRpcStartmessage.static Trace.Tracelettracelet(RpcTracelet rpcTracelet)Convert givenRpcTraceletto theirTrace.Traceletcounterpart.static List<DataTransformation>transformations(List<RpcTransformation> rpcDataTransformations)
-
-
-
Method Detail
-
start
public static RpcStart start(com.google.protobuf.Any any)
Unpack anAnycontaining anRpcStartmessage.- Parameters:
any- the any to unpack- Returns:
- the start message
- Throws:
IllegalArgumentException- if the any does not contain a message of typeRpcStart
-
finish
public static RpcFinish finish(com.google.protobuf.Any any)
Unpack anAnycontaining anRpcFinishmessage.- Parameters:
any- the any to unpack- Returns:
- the finish message
- Throws:
IllegalArgumentException- if the any does not contain a message of typeRpcFinish
-
any
public static <T extends com.google.protobuf.Message> T any(com.google.protobuf.Any any, Class<T> messageType)Upack anAnycontaining a message of given message type.- Type Parameters:
T- the type of the message contained in the any- Parameters:
any- the any to unpackmessageType- class of the message contained in the any- Returns:
- the message
- Throws:
IllegalArgumentException- if the any does not contain a message of given type
-
primitive
public static Object primitive(com.google.protobuf.Any any)
Convert given primitive message to their native Java counterpart.- Parameters:
any- the any container of the primitive message- Returns:
- the unpacked primitive
- Throws:
IllegalArgumentException- if the any is not of an expected primitive message type
-
bytes
public static byte[] bytes(com.google.protobuf.Any any)
Convert primitiveRpcBytesmessage to the native Javabyte[]counterpart.- Parameters:
any- the any container of the primitive rpc bytes message- Returns:
- the packed bytes
- Throws:
IllegalArgumentException- if given any does not contain an RpcBytes message
-
pluginInfo
public static PluginInfo pluginInfo(RpcPluginInfo rpcPluginInfo)
Convert givenRpcPluginInfoto theirPluginInfocounterpart.The API version that is available in
RpcPluginInfois not returned in thePluginInfoinstance, to get this value usepluginApiVersion(RpcPluginInfo).- Parameters:
rpcPluginInfo- the plugin info to convert- Returns:
- the converted info
- Throws:
IllegalArgumentException- when a property of given info is invalid as per thePluginInfo.Buildermethods
-
pluginId
public static PluginId pluginId(RpcPluginIdentifier rpcPluginIdentifier)
-
pluginApiVersion
public static String pluginApiVersion(RpcPluginInfo rpcPluginInfo)
Returns the API version contained in theRpcPluginInfoinstance.- Parameters:
rpcPluginInfo- the plugin info that contains the API version- Returns:
- API version
-
tracelet
public static Trace.Tracelet tracelet(RpcTracelet rpcTracelet)
Convert givenRpcTraceletto theirTrace.Traceletcounterpart.- Parameters:
rpcTracelet- the info to convert- Returns:
- the converted info
- Throws:
IllegalArgumentException- when a property of given info is invalid as per thePluginInfo.Buildermethods
-
author
public static Author author(RpcAuthor author)
- Parameters:
author- the author to convert- Returns:
- the converted author
- Throws:
IllegalArgumentException- when a property of given author is invalid as per theAuthor.Buildermethods
-
maturityLevel
public static MaturityLevel maturityLevel(RpcMaturity maturity)
Convert givenRpcMaturityto theirMaturityLevelcounterpart.- Parameters:
maturity- the maturity to convert- Returns:
- the converted maturity
- Throws:
IllegalArgumentException- when the given maturity is not mappable
-
pluginType
public static PluginType pluginType(RpcPluginType type)
Convert givenRpcPluginTypeto theirPluginTypecounterpart.- Parameters:
type- the type to convert- Returns:
- the converted type
- Throws:
IllegalArgumentException- when the given type is not mappable
-
pluginResources
public static PluginResources pluginResources(RpcPluginResources rpcPluginResources)
Convert givenRpcPluginResourcesto theirPluginResourcescounterpart.- Parameters:
rpcPluginResources- the rpc plugin resources to convert- Returns:
- the converted plugin resources
-
transformations
public static List<DataTransformation> transformations(List<RpcTransformation> rpcDataTransformations)
-
searchScope
public static TraceSearcher.SearchScope searchScope(RpcSearchScope scope)
-
-