Package com.esotericsoftware.kryo
Interface ClassResolver
-
- All Known Implementing Classes:
DefaultClassResolver
public interface ClassResolver
Handles class registration, writing class identifiers to bytes, and reading class identifiers from bytes.- Author:
- Nathan Sweet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Registration
getRegistration(int classID)
Returns the registration for the specified ID, or null if no class is registered with that ID.Registration
getRegistration(Class type)
Returns the registration for the specified class, or null if the class is not registered.Registration
readClass(Input input)
Reads a class and returns its registration.Registration
register(Registration registration)
Stores the specified registration.Registration
registerImplicit(Class type)
Called when an unregistered type is encountered andKryo.setRegistrationRequired(boolean)
is false.void
reset()
Called byKryo.reset()
.void
setKryo(Kryo kryo)
Sets the Kryo instance that this ClassResolver will be used for.Registration
unregister(int classID)
Removes the registration for the specified ID.Registration
writeClass(Output output, Class type)
Writes a class and returns its registration.
-
-
-
Method Detail
-
setKryo
void setKryo(Kryo kryo)
Sets the Kryo instance that this ClassResolver will be used for. This is called automatically by Kryo.
-
register
Registration register(Registration registration)
Stores the specified registration.- See Also:
Kryo.register(Registration)
-
unregister
Registration unregister(int classID)
Removes the registration for the specified ID.- Returns:
- May be null if the class ID was not registered.
-
registerImplicit
Registration registerImplicit(Class type)
Called when an unregistered type is encountered andKryo.setRegistrationRequired(boolean)
is false.
-
getRegistration
Registration getRegistration(Class type)
Returns the registration for the specified class, or null if the class is not registered.
-
getRegistration
Registration getRegistration(int classID)
Returns the registration for the specified ID, or null if no class is registered with that ID.
-
writeClass
Registration writeClass(Output output, Class type)
Writes a class and returns its registration.- Parameters:
type
- May be null.- Returns:
- Will be null if type is null.
-
readClass
Registration readClass(Input input)
Reads a class and returns its registration.- Returns:
- May be null.
-
reset
void reset()
Called byKryo.reset()
.
-
-