Example usage for java.util Collections EMPTY_SET

List of usage examples for java.util Collections EMPTY_SET

Introduction

In this page you can find the example usage for java.util Collections EMPTY_SET.

Prototype

Set EMPTY_SET

To view the source code for java.util Collections EMPTY_SET.

Click Source Link

Document

The empty set (immutable).

Usage

From source file:com.adobe.acs.commons.analysis.jcrchecksum.impl.options.RequestChecksumGeneratorOptions.java

private static Set<String> getPathsFromQuery(ResourceResolver resourceResolver, String language, String query) {
    if (StringUtils.isBlank(query)) {
        return Collections.EMPTY_SET;
    }//from  w w w . ja v a2  s.  c o  m

    Set<String> paths = new HashSet<String>();
    language = StringUtils.defaultIfEmpty(language, "xpath");
    Iterator<Resource> resources = resourceResolver.findResources(query, language);

    while (resources.hasNext()) {
        paths.add(resources.next().getPath());
    }

    return paths;
}

From source file:com.phoenixst.plexus.examples.EmptyGraph.java

/**
 *  Returns an empty <code>Collection</code>.
 */
public Collection edges(Predicate edgePredicate) {
    return Collections.EMPTY_SET;
}

From source file:org.mule.management.support.SimplePasswordJmxAuthenticator.java

public Subject authenticate(Object authToken) {
    if (authToken == null) {
        throw new SecurityException("No authentication token available");
    }//from w w  w  .  j  a v a2  s .  c  om
    if (!(authToken instanceof String[]) || ((String[]) authToken).length != 2) {
        throw new SecurityException("Unsupported credentials format");
    }

    String[] authentication = (String[]) authToken;

    String username = StringUtils.defaultString(authentication[0]);
    String password = StringUtils.defaultString(authentication[1]);

    if (!credentials.containsKey(username)) {
        throw new SecurityException("Unauthenticated user: " + username);
    }

    if (!password.equals(ObjectUtils.toString(credentials.get(username)))) {
        throw new SecurityException("Invalid password");
    }

    Set principals = new HashSet();
    principals.add(new JMXPrincipal(username));
    return new Subject(true, principals, Collections.EMPTY_SET, Collections.EMPTY_SET);
}

From source file:org.springframework.richclient.form.binding.support.AbstractBinder.java

protected AbstractBinder(Class requiredSourceClass) {
    this.requiredSourceClass = requiredSourceClass;
    this.supportedContextKeys = Collections.EMPTY_SET;
}

From source file:com.phoenixst.plexus.examples.EmptyGraph.java

/**
 *  Returns an empty <code>Collection</code>.
 *//*  w  w  w  .j a v  a 2 s  .c  o m*/
public Collection adjacentNodes(Object node, Predicate traverserPredicate) {
    checkNode(node);
    return Collections.EMPTY_SET;
}

From source file:org.syncope.client.util.AttributableOperations.java

private static void populate(final Map<String, AttributeTO> updatedAttrs,
        final Map<String, AttributeTO> originalAttrs, final AbstractAttributableMod result,
        final boolean virtuals) {

    for (Map.Entry<String, AttributeTO> entry : updatedAttrs.entrySet()) {
        AttributeMod mod = new AttributeMod();
        mod.setSchema(entry.getKey());/*www .j a  va  2  s  .  co  m*/

        Set<String> updatedValues = new HashSet<String>(entry.getValue().getValues());

        Set<String> originalValues = originalAttrs.containsKey(entry.getKey())
                ? new HashSet<String>(originalAttrs.get(entry.getKey()).getValues())
                : Collections.EMPTY_SET;

        if (!updatedValues.equals(originalValues)) {
            // avoid unwanted inputs
            updatedValues.remove("");
            if (!entry.getValue().isReadonly()) {
                mod.setValuesToBeAdded(new ArrayList<String>(updatedValues));

                if (!mod.isEmpty()) {
                    if (virtuals) {
                        result.addVirtualAttributeToBeRemoved(mod.getSchema());
                    } else {
                        result.addAttributeToBeRemoved(mod.getSchema());
                    }
                }
            }

            mod.setValuesToBeRemoved(new ArrayList<String>(originalValues));

            if (!mod.isEmpty()) {
                if (virtuals) {
                    result.addVirtualAttributeToBeUpdated(mod);
                } else {
                    result.addAttributeToBeUpdated(mod);
                }
            }
        }
    }
}

From source file:net.chrisrichardson.foodToGo.domain.hibernate.HibernateRestaurantRepositoryImplMockTest.java

public void setUp() {
    mockHibernateTemplate = new Mock(HibernateTemplate.class);
    hibernateTemplate = (HibernateTemplate) mockHibernateTemplate.proxy();

    repository = new HibernateRestaurantRepositoryImpl(hibernateTemplate);

    restaurant = new Restaurant("Test", "TestType", Collections.EMPTY_SET, Collections.EMPTY_SET,
            Collections.EMPTY_LIST);

}

From source file:com.blogspot.chicchiricco.persistence.AbstractBaseBean.java

/**
 * @return fields to be excluded when computing equals() or hashcode()
 *///w  w  w  . j a v  a  2 s  .  c o m
private String[] getExcludeFields() {
    Set<String> excludeFields = new HashSet<String>();

    PropertyDescriptor[] propertyDescriptors = BeanUtils.getPropertyDescriptors(getClass());
    for (int i = 0; i < propertyDescriptors.length; i++) {

        if (propertyDescriptors[i].getPropertyType().isInstance(Collections.EMPTY_SET)
                || propertyDescriptors[i].getPropertyType().isInstance(Collections.EMPTY_LIST)) {

            excludeFields.add(propertyDescriptors[i].getName());
        }
    }

    return excludeFields.toArray(new String[] {});
}

From source file:org.jboss.dashboard.ui.config.components.panelstypes.PanelsTypesPropertiesHandler.java

public void actionChangeProviders(final CommandRequest request) {
    try {//from w  w w  .j a v a 2  s  . c  om
        HibernateTxFragment txFragment = new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                WorkspaceImpl workspace = (WorkspaceImpl) getWorkspace();
                workspace.setPanelProvidersAllowed(Collections.EMPTY_SET);
                for (Enumeration paramNames = request.getRequestObject().getParameterNames(); paramNames
                        .hasMoreElements();) {
                    String paramName = (String) paramNames.nextElement();
                    if (!paramName.startsWith("CHKBOX_"))
                        continue;

                    String providerId = paramName.substring("CHKBOX_".length());
                    workspace.addPanelProviderAllowed(providerId);
                }
                UIServices.lookup().getWorkspacesManager().store(workspace);
            }
        };

        txFragment.execute();

    } catch (Exception e) {
        PanelsTypesPropertiesHandler.log.error("Error: " + e.getMessage());
    }
}

From source file:org.apache.geode.distributed.internal.StartupMessage.java

/**
 * Determine all of the addresses that this host represents. An empty list will be regarded as an
 * error by all who see it./*  ww  w  .  j ava 2s  . co m*/
 * 
 * @return list of addresses for this host
 * @since GemFire 5.7
 */
public static Set getMyAddresses(DistributionManager dm) {
    try {
        Set addresses = SocketCreator.getMyAddresses();
        return addresses;
    } catch (IllegalArgumentException e) {
        logger.fatal(e.getMessage(), e);
        return Collections.EMPTY_SET;
    }
}