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

The following examples show how to use java.util.Collections#unmodifiableSet() . 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 File: Mastery.java    From orianna with 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
Source File: InstrumentedRestApplication.java    From java-jaxrs with Apache License 2.0 5 votes vote down vote up
@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 3
Source File: TokenFactories.java    From netbeans with 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 4
Source File: RoutingController.java    From vespa with 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 5
Source File: MasterRegistrationControlEntryManager.java    From joynr with Apache License 2.0 5 votes vote down vote up
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 6
Source File: DomainHostExcludeRegistry.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 7
Source File: DefaultCacheMethodDetails.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
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 8
Source File: AccessTokenConfiguration.java    From tokens with Apache License 2.0 4 votes vote down vote up
Set<Object> getScopes() {
	return Collections.unmodifiableSet(scopes);
}
 
Example 9
Source File: IndividualNode.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
@Override
public Set<? extends TN> getDirectTypeNodes() {
	return Collections.unmodifiableSet(toTypeNodes(directTypeNodes_));
}
 
Example 10
Source File: Nodes.java    From amodeus with GNU General Public License v2.0 4 votes vote down vote up
public Set<Integer> getNodes() {
    return Collections.unmodifiableSet(nodes);
}
 
Example 11
Source File: OpBasedBlip.java    From swellrt with Apache License 2.0 4 votes vote down vote up
@Override
public Set<ParticipantId> getContributorIds() {
  return Collections.unmodifiableSet(blip.getContributors());
}
 
Example 12
Source File: DeleteObservationStringDecoder.java    From arctic-sea with Apache License 2.0 4 votes vote down vote up
@Override
public Set<DecoderKey> getKeys() {
    return Collections.unmodifiableSet(DECODER_KEYS);
}
 
Example 13
Source File: AuthenticationTokenDetails.java    From jersey-jwt with 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 14
Source File: Namespaces.java    From ldp4j with Apache License 2.0 4 votes vote down vote up
public Set<String> getDeclaredPrefixes() {
	return Collections.unmodifiableSet(map.keySet());
}
 
Example 15
Source File: InMemoryResource.java    From ldp4j with 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 16
Source File: LoopInfo.java    From Box with 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
Source File: CombinedConfigurationBuilder.java    From commons-configuration with Apache License 2.0 3 votes vote down vote up
/**
 * <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 File: ExtendedPKIXParameters.java    From ripple-lib-java with 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
Source File: JRExpressionCollector.java    From jasperreports with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * 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
Source File: AbstractLuceneIndexerImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Get the deletions
 * 
 * @return - the ids to delete
 */
public Set<String> getDeletions()
{
    return Collections.unmodifiableSet(deletions);
}