us.asciiroth.client.core
Interface Serializer<T extends Piece>

Type Parameters:
T -
All Known Implementing Classes:
BaseSerializer, NPCSerializer, TypeOnlySerializer

public interface Serializer<T extends Piece>

For each piece type there is a serializer that can convert the piece back and forth to a key, and that also provides some metadata about the type so it can be manipulated in the map editor. Those latter methods are just not included in the compiled code of the game, so they introduce no overhead and are conveniently included as part of the serializer.


Method Summary
 T create(java.lang.String[] args)
          Create a piece.
 T example()
          Provide an example of this piece for display in the editor.
 java.lang.String getTag()
          A category to file this piece under in the editor.
 java.lang.String store(T piece)
          Create a string representation of this piece, referred to in the code as a "key".
 java.lang.String template(java.lang.String type)
          Provide a template string that can be used by the editor to guide the creation of a valid instance of this type.
 

Method Detail

create

T create(java.lang.String[] args)
Create a piece. The Registry will cache this instance, returning it any time a similar piece is need in the game.

Parameters:
args - an array of strings, originally pipe-delimited, that can be used to create a valid instance of this type.
Returns:
a piece

example

T example()
Provide an example of this piece for display in the editor.

Returns:
an example piece to demonstrate the type in the map editor

getTag

java.lang.String getTag()
A category to file this piece under in the editor.

Returns:
string

store

java.lang.String store(T piece)
Create a string representation of this piece, referred to in the code as a "key".

Parameters:
piece -
Returns:
a string key for the supplied piece

template

java.lang.String template(java.lang.String type)
Provide a template string that can be used by the editor to guide the creation of a valid instance of this type.

Parameters:
type -
Returns:
a key-like template that can be used in the editor

0.7

© 2009 Alx Dark