List of usage examples for org.apache.commons.lang3 StringUtils equals
public static boolean equals(final CharSequence cs1, final CharSequence cs2)
Compares two CharSequences, returning true if they represent equal sequences of characters.
null s are handled without exceptions.
From source file:com.serotonin.m2m2.util.license.InstanceLicense.java
public InstanceLicense(Document doc) throws LicenseParseException { Element licenseElement = doc.getDocumentElement(); if (licenseElement == null || !StringUtils.equals("license", licenseElement.getTagName())) throw new LicenseParseException("Root element must be 'license'"); Element coreElement = XmlUtilsTS.getChildElement(licenseElement, "core"); if (coreElement == null) throw new LicenseParseException("Missing core element"); guid = XmlUtilsTS.getChildElementText(coreElement, "guid"); distributor = XmlUtilsTS.getChildElementText(coreElement, "distributor"); version = XmlUtilsTS.getChildElementTextAsInt(coreElement, "version", -1); licenseType = XmlUtilsTS.getChildElementText(coreElement, "licenseType"); Element featuresElement = XmlUtilsTS.getChildElement(coreElement, "features"); List<LicenseFeature> featureList = new ArrayList<LicenseFeature>(); if (featuresElement != null) { for (Element feature : XmlUtilsTS.getChildElements(featuresElement)) featureList.add(new LicenseFeature(feature)); }//from w ww . j a v a2 s.c o m features = Collections.unmodifiableList(featureList); Element modulesElement = XmlUtilsTS.getChildElement(licenseElement, "modules"); List<ModuleLicense> moduleList = new ArrayList<ModuleLicense>(); if (modulesElement != null) { for (Element module : XmlUtilsTS.getChildElements(modulesElement)) moduleList.add(new ModuleLicense(module)); } modules = Collections.unmodifiableList(moduleList); }
From source file:de.micromata.genome.logging.LogRequestParameterAttribute.java
/** * Fuer Logging gibt alle requestparameter in einer Zeile aus. * * @param request the request/*w w w.j a v a 2s. c o m*/ * @param excludingKeys the excluding keys * @return the request for logging */ public static String getRequestForLogging(HttpServletRequest request, String... excludingKeys) { if (request == null || request.getParameterMap().isEmpty() == true) { return "<no params>"; } StringBuilder sb = new StringBuilder(); for (Enumeration<?> en = request.getParameterNames(); en.hasMoreElements() == true;) { String s = (String) en.nextElement(); String[] values = request.getParameterValues(s); for (String v : values) { for (String exKey : excludingKeys) { if (StringUtils.equals(s, exKey) == true) { v = "****"; break; } } // for sb.append(s).append("=").append(v).append("\n"); } } return sb.toString(); }
From source file:AIR.Common.xml.XmlNamespaceManager.java
public void addNamespace(String prefix, String url) { Namespace newNs = Namespace.getNamespace(prefix, url); for (int counter1 = 0; counter1 < nsList.size(); ++counter1) { Namespace existing = nsList.get(counter1); if (StringUtils.equals(existing.getPrefix(), newNs.getPrefix())) { nsList.remove(counter1);/*from w w w. ja v a 2s . c o m*/ nsList.add(counter1, newNs); return; } } nsList.add(newNs); }
From source file:alfio.model.PaymentInformation.java
public boolean isFullyRefunded() { return StringUtils.equals(paidAmount, refundedAmount); }
From source file:gov.nih.nci.caintegrator.web.action.query.form.TextFieldParameter.java
/** * @param value the value to set/*from w ww .j av a 2 s. co m*/ */ public void setValue(String value) { if (!StringUtils.equals(getValue(), value.trim())) { this.value = value.trim(); if (getValueHandler().isValid(getValue())) { getValueHandler().valueChanged(value); } } }
From source file:com.mgmtp.jfunk.core.mail.MessagePredicates.java
/** * Creates a {@link Predicate} for matching a mail header. If multiple header values are present * for the given header name this Predicate returns true if at least one header value matches * the given header value.//from w ww . j a v a2 s . c o m * * @param headerName * the header name to match * @param headerValue * the header value to match * @return the predicate */ public static Predicate<MailMessage> forHeader(final String headerName, final String headerValue) { return new Predicate<MailMessage>() { @Override public boolean apply(final MailMessage input) { List<String> headers = input.getHeaders().get(headerName); for (String singleHeader : headers) { if (StringUtils.equals(singleHeader, headerValue)) { return true; } } return false; } @Override public String toString() { return String.format("headers to include header '%s=%s'", headerName, headerValue); } }; }
From source file:com.github.bjoern2.codegen.JavaGetterMethodImpl.java
public JavaGetterMethodImpl(JavaType type, String n) { setAccessType(JavaAccessType.PUBLIC); setStatic(false);// w w w .j a va 2 s . co m setReturnType(type); String name = ""; if (StringUtils.equals(type.getName(), "boolean")) { name += "is"; } else { name += "get"; } name += StringUtils.capitalize(n); setName(name); // List<JavaField> parameters = new ArrayList<JavaField>(); // parameters.add(new JavaFieldImpl(new JavaTypeImpl("String", 1), "args")); // m.setParameters(parameters); setBody("return this." + n + ";"); }
From source file:com.github.rvesse.airline.utils.predicates.parser.AliasFinder.java
@Override public boolean evaluate(AliasMetadata alias) { return alias != null && StringUtils.equals(this.name, alias.getName()); }
From source file:com.adeptj.runtime.server.IdentityManagers.java
static boolean verifyAccount(Map<String, List<String>> userRolesMapping, Account account) { return userRolesMapping.entrySet().stream() .anyMatch(entry -> StringUtils.equals(entry.getKey(), account.getPrincipal().getName()) && entry.getValue().containsAll(account.getRoles())); }
From source file:com.github.rvesse.airline.utils.predicates.parser.CommandFinder.java
@Override public boolean evaluate(CommandMetadata command) { return command != null && StringUtils.equals(this.name, command.getName()); }