下面列出了java.util.Collections#unmodifiableSet ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public Set<String> get() {
if(coreData.getIncludedData() == null) {
return null;
}
return Collections.unmodifiableSet(coreData.getIncludedData());
}
public DefaultCacheMethodDetails(Method method, A cacheAnnotation, String cacheName) {
this.method = method;
this.annotations = Collections.unmodifiableSet(
new LinkedHashSet<Annotation>(asList(method.getAnnotations())));
this.cacheAnnotation = cacheAnnotation;
this.cacheName = cacheName;
}
private VersionExcludeData(Set<String> excludedExtensions, Set<String> activeServerGroups, Set<String> activeSocketBindingGroups) {
this.excludedExtensions = excludedExtensions == null
? Collections.emptySet() : Collections.unmodifiableSet(new HashSet<>(excludedExtensions));
this.activeServerGroups = activeServerGroups == null
? Collections.emptySet() : Collections.unmodifiableSet(new HashSet<>(activeServerGroups));
this.activeSocketBindingGroups = activeSocketBindingGroups == null
? Collections.emptySet() : Collections.unmodifiableSet(new HashSet<>(activeSocketBindingGroups));
}
private MasterRegistrationControlEntry mapEntityToJoynrType(MasterRegistrationControlEntryEntity entity) {
Set<TrustLevel> possibleRequiredTrustLevels = Collections.unmodifiableSet(entity.getPossibleRequiredTrustLevels());
Set<TrustLevel> possibleRequiredControlEntryChangeTrustLevels = Collections.unmodifiableSet(entity.getPossibleRequiredControlEntryChangeTrustLevels());
Set<Permission> possibleProviderPermissions = new HashSet<>(Arrays.asList(entity.getDefaultProviderPermission()));
MasterRegistrationControlEntry entry = new MasterRegistrationControlEntry(entity.getUserId(),
entity.getDomain(),
entity.getInterfaceName(),
entity.getDefaultRequiredTrustLevel(),
possibleRequiredTrustLevels.toArray(new TrustLevel[possibleRequiredTrustLevels.size()]),
entity.getDefaultRequiredControlEntryChangeTrustLevel(),
possibleRequiredControlEntryChangeTrustLevels.toArray(new TrustLevel[possibleRequiredControlEntryChangeTrustLevels.size()]),
entity.getDefaultProviderPermission(),
possibleProviderPermissions.toArray(new Permission[possibleProviderPermissions.size()]));
return entry;
}
/**
* Register endpoints for rotations assigned to given application and zone in DNS.
*
* @return the registered endpoints
*/
public Set<ContainerEndpoint> registerEndpointsInDns(Application application, InstanceName instanceName, ZoneId zone) {
var instance = application.require(instanceName);
var containerEndpoints = new HashSet<ContainerEndpoint>();
boolean registerLegacyNames = application.deploymentSpec().instance(instanceName)
.flatMap(DeploymentInstanceSpec::globalServiceId)
.isPresent();
for (var assignedRotation : instance.rotations()) {
var names = new ArrayList<String>();
var endpoints = endpointsOf(application, instanceName).named(assignedRotation.endpointId())
.requiresRotation();
// Skip rotations which do not apply to this zone. Legacy names always point to all zones
if (!registerLegacyNames && !assignedRotation.regions().contains(zone.region())) {
continue;
}
// Omit legacy DNS names when assigning rotations using <endpoints/> syntax
if (!registerLegacyNames) {
endpoints = endpoints.not().legacy();
}
// Register names in DNS
var rotation = rotationRepository.getRotation(assignedRotation.rotationId());
if (rotation.isPresent()) {
endpoints.forEach(endpoint -> {
controller.nameServiceForwarder().createCname(RecordName.from(endpoint.dnsName()),
RecordData.fqdn(rotation.get().name()),
Priority.normal);
names.add(endpoint.dnsName());
});
}
// Include rotation ID as a valid name of this container endpoint (required by global routing health checks)
names.add(assignedRotation.rotationId().asString());
containerEndpoints.add(new ContainerEndpoint(assignedRotation.clusterId().value(), names));
}
return Collections.unmodifiableSet(containerEndpoints);
}
@Override
public Set<QName> getElementQNames() {
HashSet<QName> set = new HashSet<QName>();
for (ConfigVersion cfgVersion : ConfigVersion.values()) {
set.add(SecurityPolicyQName.ISSUER.getQName(cfgVersion));
}
return Collections.unmodifiableSet(set);
}
@Override
public Set<Object> getSingletons() {
Set<Object> objects = new HashSet<>();
objects.add(serverTracingFeature);
objects.add(new TestHandler(tracer, client));
objects.add(new DisabledTestHandler(tracer));
objects.add(new ServicesImpl());
objects.add(new ServicesImplOverrideClassPath());
objects.add(new ServicesImplOverrideMethodPath());
objects.add(new DenyFilteredFeature());
objects.add(new MappedExceptionMapper());
return Collections.unmodifiableSet(objects);
}
/**
* {@inheritDoc}
*/
@Override
public Set<InMemoryAttachment> attachments() {
return Collections.unmodifiableSet(new LinkedHashSet<InMemoryAttachment>(this.attachments.values()));
}
public Set<String> getDeclaredPrefixes() {
return Collections.unmodifiableSet(map.keySet());
}
@Override
public Set<ParticipantId> getContributorIds() {
return Collections.unmodifiableSet(blip.getContributors());
}
Set<Object> getScopes() {
return Collections.unmodifiableSet(scopes);
}
@Override
public Set<? extends TN> getDirectTypeNodes() {
return Collections.unmodifiableSet(toTypeNodes(directTypeNodes_));
}
public Set<Integer> getNodes() {
return Collections.unmodifiableSet(nodes);
}
@Override
public Set<DecoderKey> getKeys() {
return Collections.unmodifiableSet(DECODER_KEYS);
}
public Builder withAuthorities(Set<Authority> authorities) {
this.authorities = Collections.unmodifiableSet(authorities == null ? new HashSet<>() : authorities);
return this;
}
public LoopInfo(BlockNode start, BlockNode end) {
this.start = start;
this.end = end;
this.loopBlocks = Collections.unmodifiableSet(BlockUtils.getAllPathsBlocks(start, end));
}
/**
* <p>
* Returns a set with the names of all child configuration builders. A tag
* defining a configuration source in the configuration definition file can
* have the {@code config-name} attribute. If this attribute is present, the
* corresponding builder is assigned this name and can be directly accessed
* through the {@link #getNamedBuilder(String)} method. This method returns
* a collection with all available builder names.
* </p>
* <p>
* <strong>Important note:</strong> This method only returns a meaningful
* result after the result configuration has been created by calling
* {@code getConfiguration()}. If called before, always an empty set is
* returned.
* </p>
*
* @return a set with the names of all builders
*/
public synchronized Set<String> builderNames()
{
if (sourceData == null)
{
return Collections.emptySet();
}
return Collections.unmodifiableSet(sourceData.builderNames());
}
/**
* Returns the neccessary attributes which must be contained in an attribute
* certificate.
* <p>
* The returned <code>Set</code> is immutable and contains
* <code>String</code>s with the OIDs.
*
* @return Returns the necessary AC attributes.
*/
public Set getNecessaryACAttributes()
{
return Collections.unmodifiableSet(necessaryACAttributes);
}
/**
* Return all the expressions collected from the report.
*
* @return all the expressions collected from the report
*/
public Collection<JRExpression> getReportExpressions()
{
return Collections.unmodifiableSet(expressionIds.keySet());
}
/**
* Get the deletions
*
* @return - the ids to delete
*/
public Set<String> getDeletions()
{
return Collections.unmodifiableSet(deletions);
}