本文整理汇总了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);
}
示例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"));
}
}
示例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());
}
}
}
示例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();
}
示例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;
}
示例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);
}
}
}
示例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));
}
示例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;
}
}
示例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;
}
示例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));
}
示例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;
}
示例12: backwards
import java.util.EnumSet; //导入方法依赖的package包/类
EnumSet<InferenceBound> backwards() {
return (ib == InferenceBound.EQ) ?
EnumSet.allOf(InferenceBound.class) : EnumSet.of(ib);
}
示例13: createTokenIds
import java.util.EnumSet; //导入方法依赖的package包/类
@Override
protected Collection<TestTokenId> createTokenIds() {
return EnumSet.allOf(TestTokenId.class);
}
示例14: createTokenIds
import java.util.EnumSet; //导入方法依赖的package包/类
@Override
protected Collection<CssTokenId> createTokenIds() {
return EnumSet.allOf(CssTokenId.class);
}
示例15: createTokenIds
import java.util.EnumSet; //导入方法依赖的package包/类
protected synchronized Collection<DiffTokenId> createTokenIds () {
return EnumSet.allOf (DiffTokenId.class);
}