- Type Parameters:
D
- the type of the delegate transcoder
- All Superinterfaces:
Transcoder<D>
- All Known Implementing Classes:
RegistryTranscoder
Proxies all transcoder calls to the given delegate. Exists to allow passing context into
codec implementations by creating
Transcoder
subclasses.
Note: TranscoderProxy has some special handling assuming that all calls are forwarded. If that is not the case, you should inherit from Transcoder itself and NOT TranscoderProxy.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minestom.server.codec.Transcoder
Transcoder.ListBuilder<D>, Transcoder.MapBuilder<D>, Transcoder.MapLike<D>
-
Field Summary
Fields inherited from interface net.minestom.server.codec.Transcoder
CRC32_HASH, JAVA, JSON, NBT
-
Method Summary
Modifier and TypeMethodDescriptiondefault <O> Result
<O> convertTo
(Transcoder<O> coder, D value) Converts the current intermediary ofTranscoder
into intermediaryTranscoder
default D
createBoolean
(boolean value) Creates a boolean representation ofTranscoder
default D
createByte
(byte value) Creates a byte representation ofTranscoder
default D
createByteArray
(byte[] value) Creates abyte[]
representation ofTranscoder
default D
createDouble
(double value) Creates a float representation ofTranscoder
default D
createFloat
(float value) Creates a float representation ofTranscoder
default D
createInt
(int value) Creates an int representation ofTranscoder
default D
createIntArray
(int[] value) Creates aint[]
representation ofTranscoder
default Transcoder.ListBuilder
<D> createList
(int expectedSize) Creates aTranscoder.ListBuilder
default D
createLong
(long value) Creates a long representation ofTranscoder
default D
createLongArray
(long[] value) Creates along[]
representation ofTranscoder
default Transcoder.MapBuilder
<D> Creates aTranscoder.MapBuilder
default D
Creates a null representation ofTranscoder
default D
createShort
(short value) Creates a short representation ofTranscoder
default D
createString
(String value) Creates a string representation ofTranscoder
delegate()
static Transcoder
<?> extractDelegate
(Transcoder<?> transcoder) Recursively extracts the delegate from aTranscoderProxy
.getBoolean
(D value) Attempts to unwrap a boolean from the valueTranscoder
Attempts to unwrap a byte from the valueTranscoder
default Result
<byte[]> getByteArray
(D value) Attempts to unwrap abyte[]
from the valueTranscoder
Attempts to unwrap a double from the valueTranscoder
Attempts to unwrap a float from the valueTranscoder
Attempts to unwrap an int from the valueTranscoder
default Result
<int[]> getIntArray
(D value) Attempts to unwrap aint[]
from the valueTranscoder
Attempts to unwrap a list from the valueTranscoder
TheList
decoded possibly has more ofTranscoder
contained inside.Attempts to unwrap a long from the valueTranscoder
default Result
<long[]> getLongArray
(D value) Attempts to unwrap along[]
from the valueTranscoder
default Result
<Transcoder.MapLike<D>> Attempts to unwrap a map from the valueTranscoder
TheTranscoder.MapLike
decoded possibly has more ofTranscoder
contained inside.Attempts to unwrap a short from the valueTranscoder
Attempts to unwrap a string from the valueTranscoder
Methods inherited from interface net.minestom.server.codec.Transcoder
emptyList, emptyMap
-
Method Details
-
extractDelegate
Recursively extracts the delegate from aTranscoderProxy
.- Parameters:
transcoder
- The transcoder (possibly proxy) to extract- Returns:
- The delegate transcoder
-
delegate
Transcoder<D> delegate() -
createNull
Description copied from interface:Transcoder
Creates a null representation ofTranscoder
- Specified by:
createNull
in interfaceTranscoder<D>
- Returns:
- the null object, never
null
-
getBoolean
Description copied from interface:Transcoder
Attempts to unwrap a boolean from the valueTranscoder
- Specified by:
getBoolean
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
createBoolean
Description copied from interface:Transcoder
Creates a boolean representation ofTranscoder
- Specified by:
createBoolean
in interfaceTranscoder<D>
- Parameters:
value
- the boolean primitive- Returns:
- the representation of value in
Transcoder
-
getByte
Description copied from interface:Transcoder
Attempts to unwrap a byte from the valueTranscoder
- Specified by:
getByte
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
createByte
Description copied from interface:Transcoder
Creates a byte representation ofTranscoder
- Specified by:
createByte
in interfaceTranscoder<D>
- Parameters:
value
- the byte primitive- Returns:
- the representation of value in
Transcoder
-
getShort
Description copied from interface:Transcoder
Attempts to unwrap a short from the valueTranscoder
- Specified by:
getShort
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
createShort
Description copied from interface:Transcoder
Creates a short representation ofTranscoder
- Specified by:
createShort
in interfaceTranscoder<D>
- Parameters:
value
- the short primitive- Returns:
- the representation of value in
Transcoder
-
getInt
Description copied from interface:Transcoder
Attempts to unwrap an int from the valueTranscoder
- Specified by:
getInt
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
createInt
Description copied from interface:Transcoder
Creates an int representation ofTranscoder
- Specified by:
createInt
in interfaceTranscoder<D>
- Parameters:
value
- the int primitive- Returns:
- the representation of value in
Transcoder
-
getLong
Description copied from interface:Transcoder
Attempts to unwrap a long from the valueTranscoder
- Specified by:
getLong
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
createLong
Description copied from interface:Transcoder
Creates a long representation ofTranscoder
- Specified by:
createLong
in interfaceTranscoder<D>
- Parameters:
value
- the long primitive- Returns:
- the representation of value in
Transcoder
-
getFloat
Description copied from interface:Transcoder
Attempts to unwrap a float from the valueTranscoder
- Specified by:
getFloat
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
createFloat
Description copied from interface:Transcoder
Creates a float representation ofTranscoder
- Specified by:
createFloat
in interfaceTranscoder<D>
- Parameters:
value
- the float primitive- Returns:
- the representation of value in
Transcoder
-
getDouble
Description copied from interface:Transcoder
Attempts to unwrap a double from the valueTranscoder
- Specified by:
getDouble
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
createDouble
Description copied from interface:Transcoder
Creates a float representation ofTranscoder
- Specified by:
createDouble
in interfaceTranscoder<D>
- Parameters:
value
- the float primitive- Returns:
- the representation of value in
Transcoder
-
getString
Description copied from interface:Transcoder
Attempts to unwrap a string from the valueTranscoder
- Specified by:
getString
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
createString
Description copied from interface:Transcoder
Creates a string representation ofTranscoder
- Specified by:
createString
in interfaceTranscoder<D>
- Parameters:
value
- the string primitive- Returns:
- the representation of value in
Transcoder
-
createByteArray
Description copied from interface:Transcoder
Creates abyte[]
representation ofTranscoder
- Specified by:
createByteArray
in interfaceTranscoder<D>
- Parameters:
value
- the byte array- Returns:
Transcoder
representation ofbyte[]
-
getByteArray
Description copied from interface:Transcoder
Attempts to unwrap abyte[]
from the valueTranscoder
- Specified by:
getByteArray
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
createIntArray
Description copied from interface:Transcoder
Creates aint[]
representation ofTranscoder
- Specified by:
createIntArray
in interfaceTranscoder<D>
- Parameters:
value
- the int array- Returns:
Transcoder
representation ofint[]
-
getIntArray
Description copied from interface:Transcoder
Attempts to unwrap aint[]
from the valueTranscoder
- Specified by:
getIntArray
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
createLongArray
Description copied from interface:Transcoder
Creates along[]
representation ofTranscoder
- Specified by:
createLongArray
in interfaceTranscoder<D>
- Parameters:
value
- the long array- Returns:
Transcoder
representation oflong[]
-
getLongArray
Description copied from interface:Transcoder
Attempts to unwrap along[]
from the valueTranscoder
- Specified by:
getLongArray
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
getList
Description copied from interface:Transcoder
Attempts to unwrap a list from the valueTranscoder
TheList
decoded possibly has more ofTranscoder
contained inside.- Specified by:
getList
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
getMap
Description copied from interface:Transcoder
Attempts to unwrap a map from the valueTranscoder
TheTranscoder.MapLike
decoded possibly has more ofTranscoder
contained inside.- Specified by:
getMap
in interfaceTranscoder<D>
- Parameters:
value
- the value to unwrap- Returns:
- the result
-
createMap
Description copied from interface:Transcoder
Creates aTranscoder.MapBuilder
- Specified by:
createMap
in interfaceTranscoder<D>
- Returns:
- a new
Transcoder.MapBuilder
-
createList
Description copied from interface:Transcoder
Creates aTranscoder.ListBuilder
- Specified by:
createList
in interfaceTranscoder<D>
- Parameters:
expectedSize
- the initial size- Returns:
- a list builder
-
convertTo
Description copied from interface:Transcoder
Converts the current intermediary ofTranscoder
into intermediaryTranscoder
- Specified by:
convertTo
in interfaceTranscoder<D>
- Type Parameters:
O
- the intermediary type to convert to- Parameters:
coder
- the transcoder to convert tovalue
- the value to convert- Returns:
- the resultant of the conversion
-