List of usage examples for java.util Collections emptySet
@SuppressWarnings("unchecked") public static final <T> Set<T> emptySet()
From source file:com.github.jknack.amd4j.DependencyCollector.java
/** * Collect all the dependencies for the given module. * * @param config A configuration options. * @param module An AMD module./*from w w w.j av a 2 s. c o m*/ * @return A dependency set. */ public static Set<String> collect(final Config config, final Module module) { // empty module? if (module.content.length() == 0) { return Collections.emptySet(); } // just parse *.js files if (!"js".equals(getExtension(module.uri.getPath()))) { return Collections.emptySet(); } return new NodeVisitor() { private Set<String> dependencies = new LinkedHashSet<String>(); /** * Collect all the dependencies. * * @return A dependency set. */ public Set<String> collect() { Parser parser = new Parser(); AstRoot node = parser.parse(module.content.toString(), module.name, 1); node.visit(this); // check shim configuration Shim shim = config.getShim(module.name); if (shim != null) { // add dependencies if (shim.dependencies() != null) { dependencies.addAll(shim.dependencies()); } } return dependencies; } @Override public boolean visit(final AstNode node) { int type = node.getType(); switch (type) { case Token.CALL: return visit((FunctionCall) node); default: return true; } } /** * Find out "define" and "require" function calls. * * @param node The function call node. * @return True, to keep walking. */ public boolean visit(final FunctionCall node) { AstNode target = node.getTarget(); if (target instanceof Name) { String name = ((Name) target).getIdentifier(); if ("define".equals(name)) { visitDependencies(node); } else if ("require".equals(name)) { int depth = node.getParent().depth() - 1; if (config.isFindNestedDependencies() || depth == 0) { visitDependencies(node); } } } return true; } /** * Report module's dependencies. * * @param node The function's call. */ private void visitDependencies(final FunctionCall node) { List<AstNode> arguments = node.getArguments(); for (AstNode arg : arguments) { if (arg instanceof ArrayLiteral) { // found! ArrayLiteral array = (ArrayLiteral) arg; List<AstNode> dependencyList = array.getElements(); for (AstNode dependencyNode : dependencyList) { String dependency = ((StringLiteral) dependencyNode).getValue(); String[] dependencies = StringUtils.split(dependency, "!"); if (dependencies.length > 1) { this.dependencies.add(dependencies[0]); } this.dependencies.add(dependency); } break; } } } }.collect(); }
From source file:com.pc.dailymile.domain.Routes.java
public Set<Route> getRoutes() { if (routes == null) { return Collections.emptySet(); }// w ww . j av a 2 s . c o m return new TreeSet<Route>(routes); }
From source file:de.jcup.egradle.codeassist.UserInputProposalFilter.java
/** * Filter given proposals by content provider information * //from w w w. ja v a2 s.com * @param proposals * @param contentProvider * @return set of proposals, never <code>null</code> */ public Set<Proposal> filter(Set<Proposal> proposals, ProposalFactoryContentProvider contentProvider) { if (proposals == null || proposals.isEmpty()) { return Collections.emptySet(); } /* we got proposals, so filter unusable ones: */ String entered = contentProvider.getEditorSourceEnteredAtCursorPosition(); Set<Proposal> result = filterAndSetupProposals(proposals, entered); return result; }
From source file:nu.yona.server.subscriptions.service.migration.EncryptFirstAndLastName.java
@Override public void upgrade(User user) { UserDto originalUser = UserDto.createInstanceWithPrivateData(user, Collections.emptySet()); user.moveFirstAndLastNameToPrivate(); buddyService.broadcastUserInfoChangeToBuddies(user, originalUser); }
From source file:com.example.auth.ClientDetailsImpl.java
@Override public Set<String> getResourceIds() { return Collections.emptySet(); }
From source file:com.clicktravel.infrastructure.messaging.inmemory.DefaultInMemoryMessageForwardingControl.java
@PostConstruct public void init() { if (inMemoryMessageSenders == null) { inMemoryMessageSenders = Collections.emptySet(); }//from w ww.j a v a2s. c o m if (inMemoryMessagePublishers == null) { inMemoryMessagePublishers = Collections.emptySet(); } }
From source file:com.googlecode.spring.appengine.cache.memcache.MemcacheCacheManager.java
@Override protected Collection<? extends Cache> loadCaches() { return Collections.emptySet(); }
From source file:de.tudarmstadt.ukp.dkpro.core.io.brat.internal.model.BratAttributeDecl.java
public BratAttributeDecl(String aName, Collection<String> aTargetTypes) { name = aName;/* w w w. j av a2 s . c o m*/ targetTypes = aTargetTypes == null ? Collections.emptySet() : new LinkedHashSet<>(aTargetTypes); }
From source file:com.navercorp.pinpoint.web.service.map.AcceptApplicationLocalCacheV1.java
public Set<AcceptApplication> get(String host) { final Set<AcceptApplication> hit = acceptApplicationLocalCacheV1.get(host); if (CollectionUtils.isNotEmpty(hit)) { logger.debug("acceptApplicationLocalCacheV1 hit"); return hit; }/*from ww w . j a va 2 s . c o m*/ return Collections.emptySet(); }
From source file:org.cloudfoundry.identity.uaa.security.StubSecurityContextAccessor.java
@Override public Collection<? extends GrantedAuthority> getAuthorities() { return Collections.emptySet(); }