List of usage examples for com.google.common.collect ImmutableList stream
default Stream<E> stream()
From source file:com.spectralogic.ds3autogen.java.utils.ResponseAndParserUtils.java
/** * Gets the list of response codes from within a list of Ds3ResponseCodes */// w ww . ja v a2s .c om public static ImmutableList<Integer> getResponseCodes(final ImmutableList<Ds3ResponseCode> responseCodes) { if (isEmpty(responseCodes)) { return ImmutableList.of(); } return responseCodes.stream().map(Ds3ResponseCode::getCode).collect(GuavaCollectors.immutableList()); }
From source file:com.spectralogic.ds3autogen.java.utils.ResponseAndParserUtils.java
/** * Gets the imports associated with the payload models of a response code list */// w w w .j av a 2 s.c o m public static ImmutableSet<String> getImportListFromResponseCodes( final ImmutableList<Ds3ResponseCode> responseCodes) { if (isEmpty(responseCodes)) { return ImmutableSet.of(); } return responseCodes.stream().map(ResponseAndParserUtils::getImportFromResponseCode) .filter(ConverterUtil::hasContent).collect(GuavaCollectors.immutableSet()); }
From source file:com.spectralogic.ds3autogen.java.utils.ResponseAndParserUtils.java
/** * Removes response codes that are associated with errors from the list. * Error response codes are associated with values greater or equal to 400. *///from ww w . j a v a 2s . co m public static ImmutableList<Ds3ResponseCode> removeErrorResponseCodes( final ImmutableList<Ds3ResponseCode> responseCodes) { if (isEmpty(responseCodes)) { return ImmutableList.of(); } return responseCodes.stream().filter(rc -> rc.getCode() < 400).collect(GuavaCollectors.immutableList()); }
From source file:com.spectralogic.ds3autogen.java.generators.requestmodels.GetObjectRequestGenerator.java
/** * Creates the constructor for the get object request that uses OutputStream *//* w ww . jav a 2 s . c o m*/ protected static RequestConstructor createOutputStreamConstructor( final ImmutableList<Arguments> constructorArgs, final ImmutableList<Arguments> optionalArgs, final ImmutableList<QueryParam> queryParams, final String requestName, final Ds3DocSpec docSpec) { final ImmutableList.Builder<Arguments> constructorArgBuilder = ImmutableList.builder(); constructorArgBuilder.addAll(constructorArgs); constructorArgBuilder.addAll(optionalArgs); constructorArgBuilder.add(new Arguments("OutputStream", "Stream")); final ImmutableList.Builder<QueryParam> queryParamsBuilder = ImmutableList.builder(); queryParamsBuilder.addAll(queryParams); queryParamsBuilder.addAll(argsToQueryParams(optionalArgs)); final ImmutableList.Builder<Arguments> assignmentsBuilder = ImmutableList.builder(); assignmentsBuilder.addAll(constructorArgs); assignmentsBuilder.addAll(optionalArgs); final ImmutableList<Arguments> updatedConstructorArgs = constructorArgBuilder.build(); final ImmutableList<String> argNames = updatedConstructorArgs.stream().map(Arguments::getName) .collect(GuavaCollectors.immutableList()); final ImmutableList<String> additionalLines = ImmutableList .of("this.channel = Channels.newChannel(stream);"); return new RequestConstructor(false, additionalLines, updatedConstructorArgs, assignmentsBuilder.build(), queryParamsBuilder.build(), toConstructorDocs(requestName, argNames, docSpec, 1)); }
From source file:com.spectralogic.ds3autogen.java.generators.responseparser.BaseResponseParserGenerator.java
/** * Creates a comma-separated list of all expected status codes *//*from w w w .j av a2 s . c o m*/ protected static String toStatusCodeList(final ImmutableList<ResponseCode> responseCodes) { if (isEmpty(responseCodes)) { return ""; } return responseCodes.stream().map(code -> Integer.toString(code.getCode())) .collect(Collectors.joining(", ")); }
From source file:com.spectralogic.ds3autogen.java.generators.requestmodels.BulkRequestGenerator.java
/** * Gets the list of constructor arguments that need to be assigned within the * constructor. This excludes all arguments passed to the super constructor *//*from ww w. jav a2s . c o m*/ protected static ImmutableList<Arguments> toConstructorAssignmentList( final ImmutableList<Arguments> constructorArguments) { if (isEmpty(constructorArguments)) { return ImmutableList.of(); } return constructorArguments.stream().filter(arg -> !bulkBaseClassArgs.contains(arg.getName())) .collect(GuavaCollectors.immutableList()); }
From source file:com.spectralogic.ds3autogen.c.helpers.StructMemberHelper.java
public static ImmutableList<StructMember> getWrappedListChildNodes( final ImmutableList<StructMember> structMembers) { return structMembers.stream().filter(sm -> sm.getType().isArray()).filter(StructMember::hasWrapper) .collect(GuavaCollectors.immutableList()); }
From source file:com.spectralogic.ds3autogen.c.helpers.StructMemberHelper.java
/** * Used by ResponseParse.ftl and ResponseParserTopLevel.ftl */// w w w.ja v a 2 s . c om public static ImmutableList<StructMember> getUnwrappedListChildNodes( final ImmutableList<StructMember> structMembers) { return structMembers.stream().filter(sm -> sm.getType().isArray()).filter(sm -> !sm.hasWrapper()) .filter(sm -> !sm.getType().getTypeName().equals("ds3_tape_type")) // enum list .filter(sm -> !sm.getType().getTypeName().equals("ds3_tape_drive_type")) // enum list .collect(GuavaCollectors.immutableList()); }
From source file:com.spectralogic.ds3autogen.c.helpers.RequestHelper.java
public static String joinStrings(final ImmutableList<String> stringsList) { if (isEmpty(stringsList)) return "void"; return stringsList.stream().collect(Collectors.joining(", ")); }
From source file:com.spectralogic.ds3contractcomparator.print.htmlprinter.HtmlReportPrinter.java
/** * Creates the report tables for the specified type of {@link AbstractDs3TypeDiff} *//*from w ww . j a v a 2 s. c o m*/ private static ImmutableList<Table> toTypeTableList(final ImmutableList<AbstractDs3TypeDiff> typeDiffs, final Class<? extends AbstractDs3TypeDiff> typeClass) { return typeDiffs.stream().filter(t -> t.getClass() == typeClass).map(HtmlTypeTableGenerator::toTypeTable) .collect(GuavaCollectors.immutableList()); }