public class ComponentIdentifierSerializer implements Serializer<ComponentIdentifier> {
public ComponentIdentifier read(Decoder decoder) throws IOException {
byte id = decoder.readByte();
if(Implementation.BUILD.getId() == id) {
return new DefaultProjectComponentIdentifier(decoder.readString());
} else if(Implementation.MODULE.getId() == id) {
return new DefaultModuleComponentIdentifier(decoder.readString(), decoder.readString(), decoder.readString());
}
throw new IllegalArgumentException("Unable to find component identifier with id: " + id);