use of com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator in project ds3_autogen by SpectraLogic.
the class PutObjectRequestGenerator method toRequiredConstructorParams.
/**
* Gets the sorted list of required constructor params, including stream and length
*/
@Override
public ImmutableList<ConstructorParam> toRequiredConstructorParams(final Ds3Request ds3Request) {
final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
builder.addAll(getNonVoidArgsFromParamList(ds3Request.getRequiredQueryParams()));
builder.addAll(getAssignmentArguments(ds3Request));
builder.add(new Arguments("", "stream"));
builder.add(new Arguments("", "length"));
return builder.build().stream().sorted(new CustomArgumentComparator()).map(arg -> new ConstructorParam(camelToUnderscore(arg.getName()), false)).collect(GuavaCollectors.immutableList());
}
use of com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator in project ds3_autogen by SpectraLogic.
the class Helper method sortConstructorArgs.
/**
* Sorts a list of Arguments by name. Used for sorting constructor arguments for consistency.
* @param arguments List of Arguments
* @return Sorted list of Arguments
*/
public static ImmutableList<Arguments> sortConstructorArgs(final ImmutableList<Arguments> arguments) {
final List<Arguments> sortable = new ArrayList<>();
sortable.addAll(arguments);
Collections.sort(sortable, new CustomArgumentComparator());
final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
builder.addAll(sortable);
return builder.build();
}
use of com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator in project ds3_autogen by SpectraLogic.
the class BaseRequestGenerator method toRequiredConstructorParams.
/**
* Gets the sorted list of required constructor parameters for a Ds3Request
*/
@Override
public ImmutableList<ConstructorParam> toRequiredConstructorParams(final Ds3Request ds3Request) {
final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
builder.addAll(getNonVoidArgsFromParamList(ds3Request.getRequiredQueryParams()));
builder.addAll(getAssignmentArguments(ds3Request));
return builder.build().stream().sorted(new CustomArgumentComparator()).map(arg -> new ConstructorParam(camelToUnderscore(arg.getName()), false)).collect(GuavaCollectors.immutableList());
}
use of com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator in project ds3_autogen by SpectraLogic.
the class StringPayloadGenerator method toRequiredConstructorParams.
/**
* Gets the sorted list of required constructor parameters including the request payload
*/
@Override
public ImmutableList<ConstructorParam> toRequiredConstructorParams(final Ds3Request ds3Request) {
final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
builder.addAll(getNonVoidArgsFromParamList(ds3Request.getRequiredQueryParams()));
builder.addAll(getAssignmentArguments(ds3Request));
builder.add(new Arguments("string", PAYLOAD_NAME));
return builder.build().stream().sorted(new CustomArgumentComparator()).map(arg -> new ConstructorParam(camelToUnderscore(arg.getName()), false)).collect(GuavaCollectors.immutableList());
}
use of com.spectralogic.ds3autogen.utils.comparators.CustomArgumentComparator in project ds3_autogen by SpectraLogic.
the class GetObjectRequestGenerator method toRequiredConstructorParams.
/**
* Gets the sorted list of required constructor parameters, including the stream
*/
@Override
public ImmutableList<ConstructorParam> toRequiredConstructorParams(final Ds3Request ds3Request) {
final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
builder.addAll(getNonVoidArgsFromParamList(ds3Request.getRequiredQueryParams()));
builder.addAll(getAssignmentArguments(ds3Request));
builder.add(new Arguments("", "stream"));
return builder.build().stream().sorted(new CustomArgumentComparator()).map(arg -> new ConstructorParam(camelToUnderscore(arg.getName()), false)).collect(GuavaCollectors.immutableList());
}
Aggregations