Java Code Examples for java.util.Collections#unmodifiableSet()

The following examples show how to use java.util.Collections#unmodifiableSet() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: orianna   File: Mastery.java    License: MIT License 5 votes vote down vote up
@Override
public Set<String> get() {
    if(coreData.getIncludedData() == null) {
        return null;
    }
    return Collections.unmodifiableSet(coreData.getIncludedData());
}
 
Example 2
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;
}
 
Example 3
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));
}
 
Example 4
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;
}
 
Example 5
Source Project: vespa   File: RoutingController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 6
Source Project: netbeans   File: TokenFactories.java    License: Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 7
@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);
}
 
Example 8
Source Project: ldp4j   File: InMemoryResource.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Set<InMemoryAttachment> attachments() {
	return Collections.unmodifiableSet(new LinkedHashSet<InMemoryAttachment>(this.attachments.values()));
}
 
Example 9
Source Project: ldp4j   File: Namespaces.java    License: Apache License 2.0 4 votes vote down vote up
public Set<String> getDeclaredPrefixes() {
	return Collections.unmodifiableSet(map.keySet());
}
 
Example 10
Source Project: swellrt   File: OpBasedBlip.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<ParticipantId> getContributorIds() {
  return Collections.unmodifiableSet(blip.getContributors());
}
 
Example 11
Source Project: tokens   File: AccessTokenConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
Set<Object> getScopes() {
	return Collections.unmodifiableSet(scopes);
}
 
Example 12
Source Project: elk-reasoner   File: IndividualNode.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<? extends TN> getDirectTypeNodes() {
	return Collections.unmodifiableSet(toTypeNodes(directTypeNodes_));
}
 
Example 13
Source Project: amodeus   File: Nodes.java    License: GNU General Public License v2.0 4 votes vote down vote up
public Set<Integer> getNodes() {
    return Collections.unmodifiableSet(nodes);
}
 
Example 14
@Override
public Set<DecoderKey> getKeys() {
    return Collections.unmodifiableSet(DECODER_KEYS);
}
 
Example 15
Source Project: jersey-jwt   File: AuthenticationTokenDetails.java    License: MIT License 4 votes vote down vote up
public Builder withAuthorities(Set<Authority> authorities) {
    this.authorities = Collections.unmodifiableSet(authorities == null ? new HashSet<>() : authorities);
    return this;
}
 
Example 16
Source Project: Box   File: LoopInfo.java    License: Apache License 2.0 4 votes vote down vote up
public LoopInfo(BlockNode start, BlockNode end) {
	this.start = start;
	this.end = end;
	this.loopBlocks = Collections.unmodifiableSet(BlockUtils.getAllPathsBlocks(start, end));
}
 
Example 17
/**
 * <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());
}
 
Example 18
Source Project: ripple-lib-java   File: ExtendedPKIXParameters.java    License: ISC License 2 votes vote down vote up
/**
 * 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);
}
 
Example 19
/**
 * 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());
}
 
Example 20
/**
 * Get the deletions
 * 
 * @return - the ids to delete
 */
public Set<String> getDeletions()
{
    return Collections.unmodifiableSet(deletions);
}