use of org.gradle.internal.serialize.Serializer in project gradle by gradle.
the class DefaultMethodArgsSerializer method forTypes.
@Override
public Serializer<Object[]> forTypes(Class<?>[] types) {
if (types.length == 0) {
return new EmptyArraySerializer();
}
SerializerRegistry selected = null;
for (SerializerRegistry serializerRegistry : serializerRegistries) {
if (serializerRegistry.canSerialize(types[0])) {
selected = serializerRegistry;
break;
}
}
if (selected == null) {
return defaultArgsSerializer.forTypes(types);
}
final Serializer<Object>[] serializers = new Serializer[types.length];
for (int i = 0; i < types.length; i++) {
Class<?> type = types[i];
serializers[i] = (Serializer<Object>) selected.build(type);
}
return new ArraySerializer(serializers);
}
Aggregations