当前位置: 首页>>代码示例>>Java>>正文


Java FluentIterable类代码示例

本文整理汇总了Java中com.google.common.collect.FluentIterable的典型用法代码示例。如果您正苦于以下问题:Java FluentIterable类的具体用法?Java FluentIterable怎么用?Java FluentIterable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FluentIterable类属于com.google.common.collect包,在下文中一共展示了FluentIterable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: filterToType

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
public ElasticIndex filterToType(String name){
  List<ElasticMapping> filtered = new ArrayList<>();
  for(ElasticMapping m : mappings){
    for(String namePiece : name.split(",")){
      if(m.getName().equals(namePiece)){
        filtered.add(m);
      }
    }
  }
  if(filtered.isEmpty()){
    return null;
  }
  return new ElasticIndex(name, ImmutableList.<String>of(), FluentIterable.from(filtered).uniqueIndex(new Function<ElasticMapping, String>(){

    @Override
    public String apply(ElasticMapping input) {
      return input.getName();
    }}));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:20,代码来源:ElasticMappingSet.java

示例2: generateRequestOptionOverride

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
private MethodSpec generateRequestOptionOverride(ExecutableElement methodToOverride) {
  return MethodSpec.overriding(methodToOverride)
      .returns(glideOptionsName)
      .addCode(CodeBlock.builder()
          .add("return ($T) super.$N(", glideOptionsName, methodToOverride.getSimpleName())
          .add(FluentIterable.from(methodToOverride.getParameters())
              .transform(new Function<VariableElement, String>() {
                @Override
                public String apply(VariableElement input) {
                  return input.getSimpleName().toString();
                }
              })
              .join(Joiner.on(", ")))
          .add(");\n")
          .build())
      .build();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:RequestOptionsGenerator.java

示例3: useProvidedTypesForServices

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
private Set<String> useProvidedTypesForServices(TypeElement typeElement, ImmutableList<TypeMirror> typesMirrors) {
  List<String> wrongTypes = Lists.newArrayList();
  List<String> types = Lists.newArrayList();
  for (TypeMirror typeMirror : typesMirrors) {
    if (typeMirror.getKind() != TypeKind.DECLARED
        || !processing().getTypeUtils().isAssignable(typeElement.asType(), typeMirror)) {
      wrongTypes.add(typeMirror.toString());
    } else {
      types.add(typeMirror.toString());
    }
  }

  if (!wrongTypes.isEmpty()) {
    processing().getMessager().printMessage(
        Diagnostic.Kind.ERROR,
        "@Metainf.Service(value = {...}) contains types that are not implemented by "
            + typeElement.getSimpleName()
            + ": " + wrongTypes,
        typeElement,
        AnnotationMirrors.findAnnotation(typeElement.getAnnotationMirrors(), Metainf.Service.class));
  }

  return FluentIterable.from(types).toSet();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:Metaservices.java

示例4: createPermissions

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
/**
 * Create permissions, note that permissionType + targetId should be unique
 */
@Transactional
public Set<Permission> createPermissions(Set<Permission> permissions) {
    Multimap<String, String> targetIdPermissionTypes = HashMultimap.create();
    for (Permission permission : permissions) {
        targetIdPermissionTypes.put(permission.getTargetId(), permission.getPermissionType());
    }

    for (String targetId : targetIdPermissionTypes.keySet()) {
        Collection<String> permissionTypes = targetIdPermissionTypes.get(targetId);
        List<Permission> current =
                permissionRepository.findByPermissionTypeInAndTargetId(permissionTypes, targetId);
        Preconditions.checkState(CollectionUtils.isEmpty(current),
                "Permission with permissionType %s targetId %s already exists!", permissionTypes,
                targetId);
    }

    Iterable<Permission> results = permissionRepository.save(permissions);
    return FluentIterable.from(results).toSet();
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:23,代码来源:DefaultRolePermissionService.java

示例5: FilteredDataSetProducerAdapter

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
/**
 * Create a filtered adapter, passing in the list of tables to include.
 * @param producer The wrapped {@link DataSetProducer}.
 * @param includedTables The tables to include.
 */
public FilteredDataSetProducerAdapter(DataSetProducer producer, Collection<String> includedTables) {
  super(producer);
  final Set<String> includedSet = FluentIterable.from(includedTables)
                                                .transform(new Function<String, String>() {
                                                   @Override
                                                   public String apply(String str) {
                                                     return str.toUpperCase();
                                                   }
                                                 })
                                                .toSet();

  this.includingPredicate = new Predicate<String>() {
    @Override
    public boolean apply(String input) {
      return includedSet.contains(input);
    }
  };
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:24,代码来源:FilteredDataSetProducerAdapter.java

示例6: delegate

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
@Override
protected Set<TypeToken<? super T>> delegate() {
  ImmutableSet<TypeToken<? super T>> result = classes;
  if (result == null) {
    @SuppressWarnings({"unchecked", "rawtypes"})
    ImmutableList<TypeToken<? super T>> collectedTypes =
        (ImmutableList)
            TypeCollector.FOR_GENERIC_TYPE.classesOnly().collectTypes(TypeToken.this);
    return (classes =
        FluentIterable.from(collectedTypes)
            .filter(TypeFilter.IGNORE_TYPE_VARIABLE_OR_WILDCARD)
            .toSet());
  } else {
    return result;
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:17,代码来源:TypeToken.java

示例7: assertExactlyTwoSubdirectories

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
private void assertExactlyTwoSubdirectories(final File outputStoreDir) throws IOException {
  checkArgument(outputStoreDir.isDirectory());
  if (!new File(outputStoreDir, "arguments").isDirectory()) {
    throw new IOException(
        "Expected system output to be contain a subdirectory named 'arguments'");
  }
  if (!new File(outputStoreDir, "linking").isDirectory()) {
    throw new IOException("Expected system output to be contain a subdirectory named 'linking'");
  }
  final ImmutableSet<String> subdirectoryNames =
      FluentIterable.from(ImmutableList.copyOf(outputStoreDir.listFiles()))
          .transform(FileUtils.ToName)
          .toSet();
  final boolean hasValidDirectoryStructure = subdirectoryNames.containsAll(REQUIRED_SUBDIRS)
      && ALLOWED_SUBDIRS.containsAll(subdirectoryNames);

  if (!hasValidDirectoryStructure) {
    throw new IOException(
        "Invalid subdirectories ) " + subdirectoryNames + ". Required are: " + REQUIRED_SUBDIRS
        + "; allowed are " + ALLOWED_SUBDIRS);
  }
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:23,代码来源:ValidateSystemOutput.java

示例8: getStatColumnsPerField

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
protected Iterable<StatColumn> getStatColumnsPerField(final RelDataTypeField field) {
  final RelDataTypeFamily family = field.getType().getFamily();
  final Collection<StatType> dims = DIMENSIONS.get(family);
  if (dims.isEmpty()) {
    return ImmutableList.of();
  }

  return FluentIterable.from(dims)
      .transform(new Function<StatType, StatColumn>() {
        @Nullable
        @Override
        public StatColumn apply(@Nullable final StatType type) {
          return new StatColumn(type, field);
        }
      });
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:17,代码来源:AccelerationAnalyzer.java

示例9: builderIncludedTypes

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
@Value.Lazy
List<TypeElement> builderIncludedTypes() {
  Optional<FIncludeMirror> includes = builderInclude();

  ImmutableList<TypeMirror> typeMirrors = includes.isPresent()
      ? ImmutableList.copyOf(includes.get().valueMirror())
      : ImmutableList.<TypeMirror>of();

  FluentIterable<TypeElement> typeElements = FluentIterable.from(typeMirrors)
      .filter(DeclaredType.class)
      .transform(DeclatedTypeToElement.FUNCTION);

  ImmutableSet<String> uniqueTypeNames = typeElements
      .filter(IsPublic.PREDICATE)
      .transform(ElementToName.FUNCTION)
      .toSet();

  if (uniqueTypeNames.size() != typeMirrors.size()) {
    report().annotationNamed(IncludeMirror.simpleName())
        .warning("Some types were ignored, non-supported for inclusion: duplicates,"
            + " non declared reference types, non-public");
  }

  return typeElements.toList();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:Proto.java

示例10: fromTypes

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
public static TypeFetcher fromTypes() {

        return new TypeFetcher() {

            // this is technically invalid, as different apis might call.  Won't happen, but could.
            // make better
            Iterable<TypeDeclaration> foundInApi;
            @Override
            public TypeDeclaration fetchType(Api api, final String name) throws GenerationException {

                return FluentIterable.from(Optional.fromNullable(foundInApi).or(api.types()))
                        .firstMatch(namedPredicate(name)).or(fail(name));
            }

        };
    }
 
开发者ID:mulesoft-labs,项目名称:raml-java-tools,代码行数:17,代码来源:TypeFetchers.java

示例11: toString

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
@Override
public String toString() {
  Iterable<String> errorMessages = FluentIterable.from(errors).transform(OBJECT_ERROR_TO_TABBED_MESSAGE);

  StringBuilder help = new StringBuilder(500)
      .append("Usage: check-filters.sh --config=<config_file>[,<config_file>,...]")
      .append(System.lineSeparator())
      .append("Errors found in the provided configuration file:")
      .append(System.lineSeparator())
      .append(Joiner.on(System.lineSeparator()).join(errorMessages))
      .append(System.lineSeparator())
      .append("Configuration file help:")
      .append(System.lineSeparator())
      .append(TAB)
      .append("For more information and help please refer to ")
      .append(
          "https://stash/projects/HDW/repos/circus-train/circus-train-tool/circus-train-filter-tool/browse/README.md");
  return help.toString();
}
 
开发者ID:HotelsDotCom,项目名称:circus-train,代码行数:20,代码来源:FilterToolHelp.java

示例12: createChainExecutor

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
/**
 * Creates a chain executor for the given sub graph of layouts, that last started at the given time, at the given
 * refresh period.
 *
 * @param graph dependency graph
 * @param subGraph sub graph
 * @param startTimeOfLastChain last start time of the chain
 * @param refreshPeriod refresh period
 * @return chain executor
 */
private ChainExecutor createChainExecutor(DirectedGraph<DependencyNode, DefaultEdge> graph,
                                          DirectedGraph<DependencyNode, DefaultEdge> subGraph,
                                          long startTimeOfLastChain, long refreshPeriod, long gracePeriod) {
  final List<Layout> layouts = FluentIterable.from(TopologicalOrderIterator.of(subGraph))
    .transform(new Function<DependencyNode, Layout>() {
      @Override
      public Layout apply(DependencyNode node) {
        return node.getLayout();
      }
    }).toList();

  String uuid = UUID.randomUUID().toString();
  String rootId = layouts.get(0).getId().getId();
  logger.info("Creating chain executor for root node {} with id {}.", rootId, uuid);
  if (logger.isDebugEnabled()) {
    logger.debug("Sub graph for chain executor {}:{} is: {}.", rootId, uuid, layouts.toString());
  }

  return new ChainExecutor(graph, layouts, startTimeOfLastChain, refreshPeriod, gracePeriod, schedulerService,
    materializationContext, accelerationService.getSettings().getLayoutRefreshMaxAttempts(), rootId + ":" + uuid);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:32,代码来源:DependencyGraph.java

示例13: getList

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
private static <T> List<T> getList(
    Map<?, ?> map,
    Object key,
    List<T> defaultValue,
    Function<Object, T> transformation) {
  Object value = map.get(key);
  if (value == null) {
    return defaultValue;
  }

  if (value instanceof String) {
    value = Splitter.on(',').splitToList(value.toString());
  }

  if (!(value instanceof Collection)) {
    return Collections.singletonList(transformation.apply(value));
  }

  return FluentIterable.from((Collection<?>) value).transform(transformation).toList();
}
 
开发者ID:HotelsDotCom,项目名称:circus-train,代码行数:21,代码来源:MoreMapUtils.java

示例14: projectInvisibleColumn

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
@Override
public TableScan projectInvisibleColumn(String name) {
  Set<String> names = new HashSet<>();
  names.addAll(FluentIterable.from(projectedColumns).transform(new Function<SchemaPath, String>(){

    @Override
    public String apply(SchemaPath input) {
      return input.getRootSegment().getPath();
    }}).toList());

  if(names.contains(name)){
    // already included.
    return this;
  }
  List<SchemaPath> columns = new ArrayList<>();
  columns.addAll(projectedColumns);
  columns.add(SchemaPath.getSimplePath(name));
  return this.cloneWithProject(columns);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:20,代码来源:ScanCrel.java

示例15: delegate

import com.google.common.collect.FluentIterable; //导入依赖的package包/类
@Override
protected Set<TypeToken<? super T>> delegate() {
  ImmutableSet<TypeToken<? super T>> filteredTypes = types;
  if (filteredTypes == null) {
    // Java has no way to express ? super T when we parameterize TypeToken vs. Class.
    @SuppressWarnings({"unchecked", "rawtypes"})
    ImmutableList<TypeToken<? super T>> collectedTypes =
        (ImmutableList) TypeCollector.FOR_GENERIC_TYPE.collectTypes(TypeToken.this);
    return (types =
        FluentIterable.from(collectedTypes)
            .filter(TypeFilter.IGNORE_TYPE_VARIABLE_OR_WILDCARD)
            .toSet());
  } else {
    return filteredTypes;
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:17,代码来源:TypeToken.java


注:本文中的com.google.common.collect.FluentIterable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。