List of usage examples for java.util Collections unmodifiableSet
public static <T> Set<T> unmodifiableSet(Set<? extends T> s)
From source file:org.n52.iceland.binding.json.JSONBinding.java
@Override public Set<String> getConformanceClasses(String service, String version) { if (SosConstants.SOS.equals(service) && Sos2Constants.SERVICEVERSION.equals(version)) { return Collections.unmodifiableSet(CONFORMANCE_CLASSES); }// w w w. j av a2 s .co m return Collections.emptySet(); }
From source file:org.jasig.portlet.notice.util.PortletXmlRoleService.java
@PostConstruct public void init() { final Document doc = parseXml(); if (doc != null) { String roleNameCandidate; Set<String> set = new HashSet<>(); // Find all the <security-role-ref> elements in the file final NodeList roleSections = doc.getElementsByTagName("security-role-ref"); for (int i = 0; i < roleSections.getLength(); i++) { // for each <security-role-ref>, get the child nodes if (roleSections.item(i).hasChildNodes()) { final NodeList roleNames = roleSections.item(i).getChildNodes(); for (int j = 0; j < roleNames.getLength(); j++) { // go through the child nodes of each <security-role-ref> to find the <role-name> node if (roleNames.item(j).getNodeName().equalsIgnoreCase("role-name")) { // copy the <role-name> to the roles list if it's not there already roleNameCandidate = roleNames.item(j).getTextContent(); set.add(roleNameCandidate); }/* w ww.j ava 2 s .c o m*/ } } } roles = Collections.unmodifiableSet(set); logger.info("Successfully instantiated and found roles: {}", roles); } else { logger.error("Error parsing the file: {}. See other messages for trace.", PORTLET_XML_PATH); } }
From source file:org.snippr.business.entities.User.java
/** * Gets the snippets for this user */ public Set<Snippet> getSnippets() { return Collections.unmodifiableSet(this.snippets); }
From source file:com.vaadin.addon.jpacontainer.demo.domain.Invoice.java
public Set<InvoiceItem> getItems() { return Collections.unmodifiableSet(items); }
From source file:WeakIdentityHashMap.java
public Set<K> keySet() { reap();//from w w w . j a v a 2 s.c o m Set<K> ret = new HashSet<K>(); for (IdentityWeakReference ref : backingStore.keySet()) { ret.add(ref.get()); } return Collections.unmodifiableSet(ret); }
From source file:de.topicmapslab.tmcledit.model.psiprovider.internal.Subj3ctPSIProvider.java
public Set<PSIProviderResult> getSubjectIdentifier() { if (getName().length() == 0) return Collections.emptySet(); HttpMethod method = null;//from w w w .j ava2s . c o m try { String url = "http://api.subj3ct.com/subjects/search"; HttpClient client = new HttpClient(); method = new GetMethod(url); ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(2); params.add(new NameValuePair("format", "xml")); params.add(new NameValuePair("query", getName())); method.setQueryString(params.toArray(new NameValuePair[params.size()])); client.getParams().setSoTimeout(5000); client.executeMethod(method); String result = method.getResponseBodyAsString(); SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); Subj3ctXmlHandler handler = new Subj3ctXmlHandler(); parser.parse(new InputSource(new StringReader(result)), handler); List<Subje3ctResult> resultList = handler.getResultList(); if (resultList.size() == 0) { return Collections.emptySet(); } Set<PSIProviderResult> resultSet = new HashSet<PSIProviderResult>(resultList.size()); for (Subje3ctResult r : resultList) { String description = ""; if (r.name != null) description = "Name: " + r.name + "\n"; if (r.description != null) description += "Description: " + r.description + "\n"; description += "\n\nThis service is provided by http://www.subj3ct.com"; resultSet.add(new PSIProviderResult(r.identifier, description)); } return Collections.unmodifiableSet(resultSet); } catch (UnknownHostException e) { // no http connection -> no results TmcleditEditPlugin.logInfo(e); return Collections.emptySet(); } catch (SocketTimeoutException e) { // timeout -> no results TmcleditEditPlugin.logInfo(e); return Collections.emptySet(); } catch (Exception e) { throw new RuntimeException(e); } finally { if (method != null) method.releaseConnection(); } }
From source file:de.kaiserpfalzEdv.office.contacts.location.CityDO.java
@Override public Set<AreaCodeDO> getAreaCodes() { return Collections.unmodifiableSet(areaCodes); }
From source file:io.orchestrate.client.AbstractOperation.java
/** * Returns the list of listeners for this operation's future. * * @return The list of listeners for this operation's future. *//* w ww . j a va 2 s .c om*/ public final Set<OrchestrateFutureListener<T>> getListeners() { return Collections.unmodifiableSet(listeners); }
From source file:com.cybernostics.forks.jsp2x.Main.java
public Main(String[] args) throws JSAPException, IOException { SimpleJSAP jsap = new SimpleJSAP("Jsp2JspX", "Converts JSP pages to JSP documents (well-formed XML files with JSP tags).", new Parameter[] { new Switch("clobber", 'c', "clobber", "Overwrite output files even if they already exist."), new FlaggedOption("output", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'o', "output", "The path to the output folder. By default output files and logs are " + "created in the same directory as the input file."), new UnflaggedOption("file", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.GREEDY, "One or more paths to JSP files. Should not be absolute paths.") }); JSAPResult config = jsap.parse(args); if (jsap.messagePrinted()) System.exit(1);//from w ww .jav a 2 s .com this.clobber = config.getBoolean("clobber"); String outputDir = config.getString("output"); if (outputDir == null) { outputDir = ""; } else { if (!outputDir.endsWith(FS)) { outputDir += FS; } } this.outputDir = outputDir; final String[] files = config.getStringArray("file"); rewritePaths(files, outputDir != null); this.files = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(files))); checkForRewriteCollisions(); }
From source file:com.univocity.app.utils.DatabaseImpl.java
@Override public Set<String> getTableNames() { return Collections.unmodifiableSet(this.tableNames); }