Package org.refcodes.net
Interface MediaTypeFactory
-
- All Superinterfaces:
Marshalable<java.lang.String>
,MediaTypesAccessor
,Unmarshalable<java.lang.String>
- All Known Implementing Classes:
FormMediaTypeFactory
,JsonMediaTypeFactory
,TextMediaTypeFactory
,XmlMediaTypeFactory
,YamlMediaTypeFactory
public interface MediaTypeFactory extends Unmarshalable<java.lang.String>, Marshalable<java.lang.String>, MediaTypesAccessor
TheMediaTypeFactory
creates instances from an HTTP body and creates an HTTP body from given instances according to theMediaType
(as ofMediaTypesAccessor.getMediaTypes()
) for which theMediaTypeFactory
is responsible.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.net.MediaTypesAccessor
MediaTypesAccessor.MediaTypesBuilder<B extends MediaTypesAccessor.MediaTypesBuilder<B>>, MediaTypesAccessor.MediaTypesMutator, MediaTypesAccessor.MediaTypesProperty
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default java.lang.Object
fromMarshaled(java.io.InputStream aContentInputStream, java.lang.Class<?>... aTypes)
default <T> T
fromMarshaled(java.io.InputStream aContentInputStream, java.lang.Class<T> aType)
default <T> T
fromMarshaled(java.io.InputStream aContentInputStream, java.lang.Class<T> aType, java.util.Map<java.lang.String,java.lang.String> aProperties)
default java.lang.Object
fromMarshaled(java.io.InputStream aContentInputStream, java.util.Map<java.lang.String,java.lang.String> aProperties, java.lang.Class<?>... aTypes)
Same asUnmarshalable.toUnmarshaled(Object, Map, Class...)
passing anInputStream
instead of aString
.default <SRC> java.io.InputStream
fromUnmarshaled(SRC aContext)
default <SRC> java.io.InputStream
fromUnmarshaled(SRC aContext, java.util.Map<java.lang.String,java.lang.String> aProperties)
-
Methods inherited from interface org.refcodes.net.Marshalable
toMarshaled, toMarshaled
-
Methods inherited from interface org.refcodes.net.MediaTypesAccessor
getMediaTypes
-
Methods inherited from interface org.refcodes.net.Unmarshalable
toUnmarshaled, toUnmarshaled, toUnmarshaled, toUnmarshaled
-
-
-
-
Method Detail
-
fromMarshaled
default <T> T fromMarshaled(java.io.InputStream aContentInputStream, java.lang.Class<T> aType) throws org.refcodes.exception.UnmarshalException
- Type Parameters:
T
- the generic type- Parameters:
aContentInputStream
- the content input streamaType
- The type identifying the instance to be created / retrieved.- Returns:
- the t
- Throws:
org.refcodes.exception.UnmarshalException
- the unmarshal exception
-
fromMarshaled
default java.lang.Object fromMarshaled(java.io.InputStream aContentInputStream, java.lang.Class<?>... aTypes) throws org.refcodes.exception.UnmarshalException
- Parameters:
aContentInputStream
- the content input streamaTypes
- The types identifying or included by the instance to be created / retrieved.- Returns:
- the object
- Throws:
org.refcodes.exception.UnmarshalException
- the unmarshal exception
-
fromMarshaled
default java.lang.Object fromMarshaled(java.io.InputStream aContentInputStream, java.util.Map<java.lang.String,java.lang.String> aProperties, java.lang.Class<?>... aTypes) throws org.refcodes.exception.UnmarshalException
Same asUnmarshalable.toUnmarshaled(Object, Map, Class...)
passing anInputStream
instead of aString
.- Parameters:
aContentInputStream
- the content input streamaProperties
- the propertiesaTypes
- The types identifying or included by the instance to be created / retrieved.- Returns:
- the object
- Throws:
org.refcodes.exception.UnmarshalException
- the unmarshal exception
-
fromMarshaled
default <T> T fromMarshaled(java.io.InputStream aContentInputStream, java.lang.Class<T> aType, java.util.Map<java.lang.String,java.lang.String> aProperties) throws org.refcodes.exception.UnmarshalException
- Type Parameters:
T
- the generic type- Parameters:
aContentInputStream
- the content input streamaType
- The type identifying the instance to be created / retrieved.aProperties
- the properties- Returns:
- the type from the marshaled data
- Throws:
org.refcodes.exception.UnmarshalException
- the unmarshal exception
-
fromUnmarshaled
default <SRC> java.io.InputStream fromUnmarshaled(SRC aContext) throws org.refcodes.exception.MarshalException
- Type Parameters:
SRC
- the generic type- Parameters:
aContext
- the context- Returns:
- the input stream
- Throws:
org.refcodes.exception.MarshalException
- the marshal exception
-
fromUnmarshaled
default <SRC> java.io.InputStream fromUnmarshaled(SRC aContext, java.util.Map<java.lang.String,java.lang.String> aProperties) throws org.refcodes.exception.MarshalException
- Type Parameters:
SRC
- the generic type- Parameters:
aContext
- the contextaProperties
- the properties- Returns:
- the input stream
- Throws:
org.refcodes.exception.MarshalException
- the marshal exception
-
-