com.triangularpixels.rebirth.resources
Class DecoderRegistry
java.lang.Object
com.triangularpixels.rebirth.resources.DecoderRegistry
public class DecoderRegistry
- extends Object
A registry of all known decoders and what they map to.
DecoderRegistry rules:
- Registering a decoder for a primitive type automatically gets you a decoder for the corresponding wrapper class (e.g. int => Integer)
- As above, but for primitive arrays (e.g. int[] => Integer[])
- A decoder will be registered not just for an exact type match, but also to decode for any of it's base classes or interfaces
Explicit methods are provided to decode primitive types because it's impossible to reflectively convert a wrapper object (like Integer)
to a primitive generic return type (eg. T is int.class)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DecoderRegistry
public DecoderRegistry()
register
public void register(Class<?> newDecoderClass)
- Registers a static decoder
register
public void register(Object decoder)
- Registers an object decoder
hasDecoder
public boolean hasDecoder(Class<?> outputClass)
decodeBoolean
public boolean decodeBoolean(String input)
decodeInt
public int decodeInt(String input)
decodeLong
public long decodeLong(String input)
decodeFloat
public float decodeFloat(String input)
decodeDouble
public double decodeDouble(String input)
decodeShort
public short decodeShort(String input)
decodeByte
public byte decodeByte(String input)
decodeChar
public char decodeChar(String input)
decode
public <T> T decode(Class<T> outputClass,
String input)
decode
public <T> T decode(Class<T> outputClass,
Element input)
Copyright © 2009 TriangularPixels.com. All Rights Reserved.