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