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


Java EnumSet.allOf方法代码示例

本文整理汇总了Java中java.util.EnumSet.allOf方法的典型用法代码示例。如果您正苦于以下问题:Java EnumSet.allOf方法的具体用法?Java EnumSet.allOf怎么用?Java EnumSet.allOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.EnumSet的用法示例。


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

示例1: getSubcsriptionsWithRoles

import java.util.EnumSet; //导入方法依赖的package包/类
@Test
public void getSubcsriptionsWithRoles() {
    // given
    Organization owner = new Organization();
    owner.setKey(9876);
    Set<SubscriptionStatus> states = EnumSet
            .allOf(SubscriptionStatus.class);

    // when
    List<SubscriptionWithRoles> list = bean.getSubcsriptionsWithRoles(
            owner, states);

    // then
    verify(subscriptionDao, times(1)).getSubscriptionsWithRoles(
            any(Organization.class), eq(states));
    verify(bean.slc, times(1)).convert(anyListOf(Object[].class));
    assertNotNull(list);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:19,代码来源:SubscriptionListServiceBeanTest.java

示例2: testInvalid

import java.util.EnumSet; //导入方法依赖的package包/类
/** Don't silently do DNS lookups or anything trappy on bogus data */
public void testInvalid() throws Exception {
    InputStream database = getDatabaseFileInputStream("/GeoLite2-City.mmdb.gz");
    GeoIpProcessor processor = new GeoIpProcessor(randomAsciiOfLength(10), "source_field",
            new DatabaseReader.Builder(database).build(), "target_field", EnumSet.allOf(GeoIpProcessor.Property.class), false);

    Map<String, Object> document = new HashMap<>();
    document.put("source_field", "www.google.com");
    IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
    try {
        processor.execute(ingestDocument);
        fail("did not get expected exception");
    } catch (IllegalArgumentException expected) {
        assertNotNull(expected.getMessage());
        assertThat(expected.getMessage(), containsString("not an IP string literal"));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:GeoIpProcessorTests.java

示例3: testDirectoryDeletion_sdsNotSupported_fails

import java.util.EnumSet; //导入方法依赖的package包/类
public void testDirectoryDeletion_sdsNotSupported_fails() throws IOException {
  for (DirectoryDeleteMethod method : EnumSet.allOf(DirectoryDeleteMethod.class)) {
    try (FileSystem fs = newTestFileSystem()) {
      Path dir = fs.getPath("dir");
      assertEquals(6, MoreFiles.listFiles(dir).size());

      try {
        method.delete(dir);
        fail("expected InsecureRecursiveDeleteException");
      } catch (InsecureRecursiveDeleteException expected) {
      }

      assertTrue(Files.exists(dir));
      assertEquals(6, MoreFiles.listFiles(dir).size());
    }
  }
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:18,代码来源:MoreFilesTest.java

示例4: getNodeReports

import java.util.EnumSet; //导入方法依赖的package包/类
@Override
public List<NodeReport> getNodeReports(NodeState... states) throws YarnException,
    IOException {
  EnumSet<NodeState> statesSet = (states.length == 0) ?
      EnumSet.allOf(NodeState.class) : EnumSet.noneOf(NodeState.class);
  for (NodeState state : states) {
    statesSet.add(state);
  }
  GetClusterNodesRequest request = GetClusterNodesRequest
      .newInstance(statesSet);
  GetClusterNodesResponse response = rmClient.getClusterNodes(request);
  return response.getNodeReports();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:YarnClientImpl.java

示例5: getEnums

import java.util.EnumSet; //导入方法依赖的package包/类
public static <E extends Enum<E>> List<E> getEnums(Class<E> pEnumeration, boolean pSorted) {
  Set<E> set = EnumSet.allOf(pEnumeration);
  List<E> result = new ArrayList<E>();
  result.addAll(set);
  Collections.sort(result, (e1, e2) -> Integer.compare(e1.ordinal(), e2.ordinal()));
  return result;
}
 
开发者ID:flybotix,项目名称:highfrequencyrobots,代码行数:8,代码来源:EnumUtils.java

示例6: testDirectoryDeletion_emptyDir

import java.util.EnumSet; //导入方法依赖的package包/类
public void testDirectoryDeletion_emptyDir() throws IOException {
  for (DirectoryDeleteMethod method : EnumSet.allOf(DirectoryDeleteMethod.class)) {
    try (FileSystem fs = newTestFileSystem(SECURE_DIRECTORY_STREAM)) {
      Path emptyDir = fs.getPath("dir/e");
      assertEquals(0, MoreFiles.listFiles(emptyDir).size());

      method.delete(emptyDir);
      method.assertDeleteSucceeded(emptyDir);
    }
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:12,代码来源:MoreFilesTest.java

示例7: testCity_withIpV6

import java.util.EnumSet; //导入方法依赖的package包/类
public void testCity_withIpV6() throws Exception {
    InputStream database = getDatabaseFileInputStream("/GeoLite2-City.mmdb.gz");
    GeoIpProcessor processor = new GeoIpProcessor(randomAsciiOfLength(10), "source_field",
            new DatabaseReader.Builder(database).build(), "target_field", EnumSet.allOf(GeoIpProcessor.Property.class), false);

    String address = "2602:306:33d3:8000::3257:9652";
    Map<String, Object> document = new HashMap<>();
    document.put("source_field", address);
    IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
    processor.execute(ingestDocument);

    assertThat(ingestDocument.getSourceAndMetadata().get("source_field"), equalTo(address));
    @SuppressWarnings("unchecked")
    Map<String, Object> geoData = (Map<String, Object>) ingestDocument.getSourceAndMetadata().get("target_field");
    assertThat(geoData.size(), equalTo(8));
    assertThat(geoData.get("ip"), equalTo(address));
    assertThat(geoData.get("country_iso_code"), equalTo("US"));
    assertThat(geoData.get("country_name"), equalTo("United States"));
    assertThat(geoData.get("continent_name"), equalTo("North America"));
    assertThat(geoData.get("region_name"), equalTo("Florida"));
    assertThat(geoData.get("city_name"), equalTo("Hollywood"));
    assertThat(geoData.get("timezone"), equalTo("America/New_York"));
    Map<String, Object> location = new HashMap<>();
    location.put("lat", 26.0252d);
    location.put("lon", -80.296d);
    assertThat(geoData.get("location"), equalTo(location));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:28,代码来源:GeoIpProcessorTests.java

示例8: hashOf

import java.util.EnumSet; //导入方法依赖的package包/类
public synchronized static <E extends Enum<E>> int hashOf(Class<E> pEnumeration) {
  if(hashes.containsKey(pEnumeration)) {
    return hashes.get(pEnumeration);
  } else {
    Set<E> set = EnumSet.allOf(pEnumeration);
    final int p = 31;
    int result = 1;
    for(E e : set) {
      result += p * result + e.name().hashCode();
    }
    hashes.put(pEnumeration, result);
    return result;
  }
}
 
开发者ID:flybotix,项目名称:highfrequencyrobots,代码行数:15,代码来源:EnumUtils.java

示例9: isComplete

import java.util.EnumSet; //导入方法依赖的package包/类
/**
 * Returns true if the entire startup process has completed, determined by
 * checking if each phase is complete.
 * 
 * @return boolean true if the entire startup process has completed
 */
private boolean isComplete() {
  for (Phase phase: EnumSet.allOf(Phase.class)) {
    if (getStatus(phase) != Status.COMPLETE) {
      return false;
    }
  }
  return true;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:StartupProgress.java

示例10: testAddressIsNotInTheDatabase

import java.util.EnumSet; //导入方法依赖的package包/类
public void testAddressIsNotInTheDatabase() throws Exception {
    InputStream database = getDatabaseFileInputStream("/GeoLite2-City.mmdb.gz");
    GeoIpProcessor processor = new GeoIpProcessor(randomAsciiOfLength(10), "source_field",
            new DatabaseReader.Builder(database).build(), "target_field", EnumSet.allOf(GeoIpProcessor.Property.class), false);

    Map<String, Object> document = new HashMap<>();
    document.put("source_field", "127.0.0.1");
    IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
    processor.execute(ingestDocument);
    assertThat(ingestDocument.getSourceAndMetadata().containsKey("target_field"), is(false));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:GeoIpProcessorTests.java

示例11: populateCache

import java.util.EnumSet; //导入方法依赖的package包/类
@GwtIncompatible("java.lang.ref.WeakReference")
private static <T extends Enum<T>> Map<String, WeakReference<? extends Enum<?>>> populateCache(
    Class<T> enumClass) {
  Map<String, WeakReference<? extends Enum<?>>> result
      = new HashMap<String, WeakReference<? extends Enum<?>>>();
  for (T enumInstance : EnumSet.allOf(enumClass)) {
    result.put(enumInstance.name(), new WeakReference<Enum<?>>(enumInstance));
  }
  enumConstantCache.put(enumClass, result);
  return result;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:12,代码来源:Enums.java

示例12: backwards

import java.util.EnumSet; //导入方法依赖的package包/类
EnumSet<InferenceBound> backwards() {
    return (ib == InferenceBound.EQ) ?
            EnumSet.allOf(InferenceBound.class) : EnumSet.of(ib);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:Infer.java

示例13: createTokenIds

import java.util.EnumSet; //导入方法依赖的package包/类
@Override
protected Collection<TestTokenId> createTokenIds() {
    return EnumSet.allOf(TestTokenId.class);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:LanguageRegistrationTest.java

示例14: createTokenIds

import java.util.EnumSet; //导入方法依赖的package包/类
@Override
protected Collection<CssTokenId> createTokenIds() {
    return EnumSet.allOf(CssTokenId.class);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CssLanguageHierarchy.java

示例15: createTokenIds

import java.util.EnumSet; //导入方法依赖的package包/类
protected synchronized Collection<DiffTokenId> createTokenIds () {
    return EnumSet.allOf (DiffTokenId.class);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:DiffLanguageHierarchy.java


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