本文整理汇总了Java中com.google.common.collect.Sets.immutableEnumSet方法的典型用法代码示例。如果您正苦于以下问题:Java Sets.immutableEnumSet方法的具体用法?Java Sets.immutableEnumSet怎么用?Java Sets.immutableEnumSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Sets
的用法示例。
在下文中一共展示了Sets.immutableEnumSet方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getScopes
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<? super QualifiedContent.Scope> getScopes() {
if (!config.inlineR) // empty scope
return ImmutableSet.of();
// full
return Sets.immutableEnumSet(
QualifiedContent.Scope.PROJECT,
QualifiedContent.Scope.SUB_PROJECTS,
QualifiedContent.Scope.EXTERNAL_LIBRARIES);
}
示例2: testCanFetchLabels
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Test
public void testCanFetchLabels() throws Exception {
if (!testServerConfig.imapConfiguration().hostAndPort().getHost().contains("gmail")) {
return;
}
Set<SystemLabel> systemLabels = Sets.immutableEnumSet(SystemLabel.DRAFTS, SystemLabel.INBOX, SystemLabel.SENT);
try (ImapClient client = getLoggedInClient(testServerConfig)) {
CompletableFuture<OpenResponse> openResponseFuture = client.open(testServerConfig.primaryFolder(), FolderOpenMode.WRITE);
OpenResponse or = openResponseFuture.get();
assertThat(or.getCode()).isEqualTo(ResponseCode.OK);
CompletableFuture<FetchResponse> fetchResponseFuture = client.fetch(1, Optional.empty(), FetchDataItemType.X_GM_LABELS);
FetchResponse fetchResponse = fetchResponseFuture.get();
Optional<Set<GMailLabel>> allFetchedLabels = fetchResponse.getMessages()
.stream()
.map(m -> {
try {
return m.getGMailLabels();
} catch (UnfetchedFieldException e) {
throw new RuntimeException(e);
}
}).reduce(Sets::union);
assertThat(allFetchedLabels).isPresent();
assertThat(allFetchedLabels.get()).containsAll(systemLabels);
}
}
示例3: Result
import com.google.common.collect.Sets; //导入方法依赖的package包/类
/** */
public Result(
Scheme scheme, String originalUrlText,
PartRanges originalUrlRanges, String absUrlText, PartRanges absUrlRanges,
EnumSet<UrlValue.CornerCase> cornerCases) {
this.scheme = scheme;
this.originalUrlText = originalUrlText;
this.originalUrlRanges = originalUrlRanges;
this.absUrlText = absUrlText;
this.absUrlRanges = absUrlRanges;
this.cornerCases = Sets.immutableEnumSet(cornerCases);
}
示例4: EnderpearlListener
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public EnderpearlListener() {
enderpearlCooldownMap = new HashMap<>();
enderpearlCooldownTime = 16;
blockedPearlTypes = Sets.immutableEnumSet(Material.THIN_GLASS,
new Material[] { Material.IRON_FENCE, Material.FENCE, Material.NETHER_FENCE, Material.FENCE_GATE,
Material.ACACIA_STAIRS, Material.BIRCH_WOOD_STAIRS, Material.BRICK_STAIRS,
Material.COBBLESTONE_STAIRS, Material.DARK_OAK_STAIRS, Material.JUNGLE_WOOD_STAIRS,
Material.NETHER_BRICK_STAIRS, Material.QUARTZ_STAIRS, Material.SANDSTONE_STAIRS,
Material.SMOOTH_STAIRS, Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS });
}
示例5: DebugCounterImpl
import com.google.common.collect.Sets; //导入方法依赖的package包/类
DebugCounterImpl(@Nonnull String moduleName,
@Nonnull String counterHierarchy,
@Nonnull String description,
@Nonnull Collection<MetaData> metaData) {
this.moduleName = moduleName;
this.counterHierarchy = counterHierarchy;
this.description = description;
this.metaData = Sets.immutableEnumSet(metaData);
this.lastModified.setTime(System.currentTimeMillis());
}
示例6: PearlFix
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public PearlFix() {
this.blockedTypes = Sets.immutableEnumSet(Material.THIN_GLASS,
Material.IRON_FENCE, Material.FENCE, Material.NETHER_FENCE,
Material.FENCE_GATE, Material.ACACIA_STAIRS, Material.BIRCH_WOOD_STAIRS, Material.BRICK_STAIRS,
Material.COBBLESTONE_STAIRS, Material.DARK_OAK_STAIRS, Material.JUNGLE_WOOD_STAIRS,
Material.NETHER_BRICK_STAIRS, Material.QUARTZ_STAIRS, Material.SANDSTONE_STAIRS,
Material.SMOOTH_STAIRS, Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS);
}
示例7: validateHandshake
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
protected void validateHandshake(BitToUserHandshake inbound) throws RpcException {
// logger.debug("Handling handshake from bit to user. {}", inbound);
if (inbound.hasServerInfos()) {
serverInfos = inbound.getServerInfos();
}
supportedMethods = Sets.immutableEnumSet(inbound.getSupportedMethodsList());
if (inbound.getStatus() != HandshakeStatus.SUCCESS) {
final String errMsg = String.format("Status: %s, Error Id: %s, Error message: %s",
inbound.getStatus(), inbound.getErrorId(), inbound.getErrorMessage());
logger.error(errMsg);
throw new RpcException(errMsg);
}
}
示例8: getReferencedScopes
import com.google.common.collect.Sets; //导入方法依赖的package包/类
@Override
public Set<? super QualifiedContent.Scope> getReferencedScopes() {
if (config.inlineR) // empty
return ImmutableSet.of();
return Sets.immutableEnumSet(QualifiedContent.Scope.PROJECT);
}
示例9: FieldDefinition
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public FieldDefinition(EnumSet<Access> access, String name, ParameterizedType type)
{
this.access = Sets.immutableEnumSet(access);
this.name = name;
this.type = type;
}
示例10: build
import com.google.common.collect.Sets; //导入方法依赖的package包/类
/**
* Builds a classifier based on previous allow/match decisions.
* This may be reused after a call to build and subsequent calls to
* allow/match methods will not affect previously built classifiers.
* @return this
*/
public UrlClassifier build() {
ImmutableSet<UrlValue.CornerCase> toleratedCornerCaseSet =
Sets.immutableEnumSet(this.toleratedCornerCases);
ImmutableSet<Scheme> allowedSchemeSet = allowedSchemes.build();
MediaTypeClassifier mtc = mediaTypeClassifier != null
? mediaTypeClassifier
: MediaTypeClassifiers.or();
AuthorityClassifier ac = authorityClassifier != null
? authorityClassifier
: AuthorityClassifiers.any();
ImmutableSet<String> positivePathGlobSet = positivePathGlobs.build();
ImmutableSet<String> negativePathGlobSet = negativePathGlobs.build();
Pattern positivePathPattern = positivePathGlobSet.isEmpty()
? null
: PathGlobs.toPattern(positivePathGlobSet);
Pattern negativePathPattern = negativePathGlobSet.isEmpty()
? null
: PathGlobs.toPattern(negativePathGlobSet);
QueryClassifier qc = queryClassifier != null
? queryClassifier
: QueryClassifiers.any();
FragmentClassifier fc = fragmentClassifier != null
? fragmentClassifier
: FragmentClassifiers.any();
ContentClassifier cc = contentClassifier != null
? contentClassifier
: ContentClassifiers.any();
return new UrlClassifierImpl(
toleratedCornerCaseSet,
allowedSchemeSet,
mtc,
ac,
positivePathPattern,
negativePathPattern,
qc,
fc,
cc
);
}
示例11: UrlValue
import com.google.common.collect.Sets; //导入方法依赖的package包/类
private UrlValue(UrlContext context, String originalUrlText) {
this.context = context;
this.originalUrlText = originalUrlText;
EnumSet<CornerCase> extraCornerCases = EnumSet.noneOf(
CornerCase.class);
String refUrlText = originalUrlText;
switch (context.microsoftPathStrategy) {
case BACK_TO_FORWARD:
int eos = Absolutizer.endOfScheme(refUrlText);
@SuppressWarnings("hiding")
Scheme scheme = null;
if (eos >= 0) {
scheme = context.absolutizer.schemes.schemeForName(
refUrlText.substring(0, eos - 1 /* ':' */));
}
if (scheme == null || scheme.isHierarchical) {
refUrlText = refUrlText.replace('\\', '/');
if (!refUrlText.equals(originalUrlText)) {
extraCornerCases.add(CornerCase.FLIPPED_SLASHES);
}
}
break;
case STANDARDS_COMPLIANT:
break;
}
Absolutizer.Result abs = context.absolutizer.absolutize(refUrlText);
this.scheme = abs.scheme;
this.urlText = abs.absUrlText;
this.ranges = abs.absUrlRanges;
if (ranges == null || ranges.authorityLeft == ranges.authorityRight) {
this.rawAuthority = null;
this.authority = null;
this.inheritsPlaceholderAuthority = false;
} else {
this.rawAuthority = this.urlText.substring(
this.ranges.authorityLeft, this.ranges.authorityRight);
this.inheritsPlaceholderAuthority = this.ranges != null
&& abs.originalUrlRanges.authorityLeft < 0
&& UrlContext.PLACEHOLDER_AUTHORITY.equals(rawAuthority);
this.authority = Authority.decode(this, Diagnostic.Receiver.NULL);
if (this.authority != null) {
if (!this.authority.hasValidHost()) {
extraCornerCases.add(CornerCase.IDNA_INVALID_HOST);
} else if (this.authority.hasTransitionalDifference()) {
extraCornerCases.add(CornerCase.IDNA_TRANSITIONAL_DIFFERENCE);
}
}
}
ImmutableSet<CornerCase> allCornerCases = abs.cornerCases;
if (!extraCornerCases.isEmpty()) {
extraCornerCases.addAll(allCornerCases);
allCornerCases = Sets.immutableEnumSet(extraCornerCases);
}
this.cornerCases = allCornerCases;
}
示例12: getSupportedMethods
import com.google.common.collect.Sets; //导入方法依赖的package包/类
/**
* Returns the list of methods supported by the server based on its advertised information.
*
* @param supported methods the list of supported rpc types
* @return a immutable set of capabilities
*/
static final Set<ServerMethod> getSupportedMethods(Iterable<RpcType> supportedMethods, RpcEndpointInfos serverInfos) {
boolean supportedMethodsEmpty = true;
ImmutableSet.Builder<ServerMethod> builder = ImmutableSet.builder();
for(RpcType supportedMethod: supportedMethods) {
supportedMethodsEmpty = false;
ServerMethod method = REVERSE_MAPPING.get(supportedMethod);
if (method == null) {
// The server might have newer methods we don't know how to handle yet.
continue;
}
builder.add(method);
}
if (!supportedMethodsEmpty) {
return Sets.immutableEnumSet(builder.build());
}
final boolean isDremio;
final Version serverVersion;
if (serverInfos == null) {
isDremio = false;
serverVersion = Constants.DRILL_0_0_0;
} else {
String serverName = serverInfos.getName().toLowerCase(Locale.ROOT);
isDremio = serverName.contains("dremio");
serverVersion = UserRpcUtils.getVersion(serverInfos);
}
// Fallback to version detection if version is below Dremio 0.9.2
// or Drill 1.10
for(ServerMethod capability: ServerMethod.values()) {
Version minVersion = isDremio ? capability.getMinVersion() : capability.getMinDrillVersion();
if (serverVersion.compareTo(minVersion) >= 0) {
builder.add(capability);
}
}
return Sets.immutableEnumSet(builder.build());
}
示例13: ContextService
import com.google.common.collect.Sets; //导入方法依赖的package包/类
public ContextService(
BindingCreator bindingCreator,
BootStrapContext bootstrapContext,
Provider<ClusterCoordinator> coord,
Provider<PersistentStoreProvider> provider,
Provider<WorkStats> workStats,
Provider<KVStoreProvider> kvStoreProvider,
Provider<FabricService> fabric,
Provider<UserServer> userServer,
Provider<MaterializationDescriptorProvider> materializationDescriptorProvider,
Provider<QueryObserverFactory> queryObserverFactory,
Provider<RunningQueryProvider> runningQueriesProvider,
Provider<AccelerationManager> accelerationManager,
Provider<AccelerationListManager> accelerationListManager,
Provider<NamespaceService.Factory> namespaceServiceFactoryProvider,
Provider<UserService> userService,
Provider<CatalogService> catalogService,
Provider<ViewCreatorFactory> viewCreatorFactory,
boolean updateDremioDefaults,
Set<ClusterCoordinator.Role> roles,
boolean isMaster) {
super();
this.bindingCreator = bindingCreator;
this.bootstrapContext = bootstrapContext;
this.provider = provider;
this.workStats = workStats;
this.kvStoreProvider = kvStoreProvider;
this.userServer = userServer;
this.coord = coord;
this.fabric = fabric;
this.materializationDescriptorProvider = materializationDescriptorProvider;
this.queryObserverFactory = queryObserverFactory;
this.accelerationManager = accelerationManager;
this.accelerationListManager = accelerationListManager;
this.namespaceServiceFactoryProvider = namespaceServiceFactoryProvider;
this.userService = userService;
this.updateDremioDefaults = updateDremioDefaults;
this.runningQueriesProvider = runningQueriesProvider;
this.catalogService = catalogService;
this.viewCreatorFactory = viewCreatorFactory;
this.roles = Sets.immutableEnumSet(roles);
this.isMaster = isMaster;
}