List of usage examples for org.apache.commons.lang StringUtils equals
public static boolean equals(String str1, String str2)
Compares two Strings, returning true
if they are equal.
From source file:com.iggroup.oss.restdoclet.doclet.util.AnnotationUtils.java
/** * Finds the annotation the argument of a method is annotated with. * //from w ww .ja v a 2 s.co m * @param param the argument to check for annotations. * @param type the type of annotation to look for. * @return the annotation the argument is annotated with or * <code>null</code> if the annotation is not found. */ public static AnnotationDesc annotation(final Parameter param, final Class<?> type) { AnnotationDesc result = null; for (final AnnotationDesc annotation : annotations(param)) { final String name = annotation.annotationType().qualifiedName(); if (StringUtils.equals(type.getName(), name)) { result = annotation; break; } } return result; }
From source file:com.proper.uip.common.utils.Page.java
/** * ???./*from w w w.j ava2s.co m*/ * * @param order ?descasc,?','. */ public void setOrder(final String order) { String lowcaseOrder = StringUtils.lowerCase(order); //order? String[] orders = StringUtils.split(lowcaseOrder, ','); for (String orderStr : orders) { if (!StringUtils.equals(PageConfig.DESC, orderStr) && !StringUtils.equals(PageConfig.ASC, orderStr)) { throw new IllegalArgumentException("??" + orderStr + "??"); } } this.order = lowcaseOrder; }
From source file:com.example.office.DOCDocumentParse.java
@SuppressWarnings("unused") private File doc2docxOld(File docFile) { String docxFilePath = docFile.getPath() + "x"; File docxFile = new File(docxFilePath); if (!docxFile.exists()) { XWPFDocument document = null;/*from w ww .j a v a 2 s .c om*/ try (InputStream ins = new FileInputStream(docxFile); OutputStream out = new FileOutputStream(docxFile);) { Document doc = new Document(docFile.getPath()); doc.save(docxFile.getPath()); document = new XWPFDocument(ins); // document.removeBodyElement(0) List<IBodyElement> elements = document.getBodyElements(); IBodyElement element = elements.get(elements.size() - 1); if (StringUtils.equals(BodyElementType.PARAGRAPH.name(), element.getElementType().name())) { XWPFParagraph xp = ((XWPFParagraph) element); String text = xp.getText(); if (StringUtils.isNotBlank(text)) { if (text.contains("Evaluation") && text.contains("Aspose")) { document.removeBodyElement(elements.size() - 1); } } } IBodyElement element0 = elements.get(0); if (StringUtils.equals(BodyElementType.PARAGRAPH.name(), element0.getElementType().name())) { XWPFParagraph xp = ((XWPFParagraph) element0); String text = xp.getText(); if (StringUtils.isNotBlank(text)) { if (text.contains("Evaluation") && text.contains("Aspose")) { document.removeBodyElement(0); } } } document.write(out); } catch (Exception e) { LogUtils.writeWarnExceptionLog(log, e); } finally { try { if (document != null) document.close(); } catch (IOException e) { LogUtils.writeDebugExceptionLog(log, e); } } } return docxFile; }
From source file:net.noday.core.dnspod.Dnspod.java
public static String domainInfo(String dnspodDomainId) { Document doc;/*w w w. j a va2 s.c o m*/ try { doc = Jsoup.connect(url_domainInfo).data(data).data("domain_id", dnspodDomainId).userAgent(user_agent) .post(); JSONObject o = JSON.parseObject(doc.body().text()); String code = o.getJSONObject("status").getString("code"); if (StringUtils.equals(code, "1")) { return o.getJSONObject("domain").getString("ext_status"); } throw new DnspodException(o.getJSONObject("status").getString("message")); } catch (IOException e) { throw new DnspodException(e.getMessage()); } }
From source file:be.fedict.eid.pkira.blm.model.reporting.ReportConfigurationHandler.java
public void generateReport() { if (StringUtils.isBlank(startMonth) || StringUtils.isBlank(endMonth)) { return;//from ww w . j a v a 2s . co m } if (startMonth.compareTo(endMonth) > 0) { facesMessages.addFromResourceBundle(Severity.ERROR, "reports.startAfterEnd"); return; } HttpServletResponse response = (HttpServletResponse) externalContext.getResponse(); response.setContentType("test/xml"); String fileName = (StringUtils.equals(startMonth, endMonth) ? startMonth : startMonth + " - " + endMonth) + ".xml\""; response.addHeader("Content-disposition", "attachment; filename=\"" + fileName); String report = reportManager.generateReport(startMonth, endMonth, includeCertificateAuthorityReport, includeCertificateDomainReport); try { ServletOutputStream servletOutputStream = response.getOutputStream(); servletOutputStream.write(report.getBytes()); servletOutputStream.flush(); servletOutputStream.close(); } catch (IOException e) { throw new RuntimeException(e); } facesContext.responseComplete(); }
From source file:AIR.Common.Web.Session.CookieHolder.java
public MultiValueCookie findCookie(String name) { Iterator<MultiValueCookie> cookies = this.iterator(); while (cookies.hasNext()) { MultiValueCookie cookie = cookies.next(); if (StringUtils.equals(name, cookie.getName())) return cookie; }/* w ww .j a v a 2 s .c o m*/ return null; }
From source file:com.htmlhifive.tools.jslint.JSLintPluginBuilder.java
/** * ??.<br>/* ww w . j a v a2s.c o m*/ * js??. * * @param resource . * @throws CoreException ?. */ private void checkJs(IResource resource) throws CoreException { if (resource instanceof IFile && StringUtils.equals(resource.getFileExtension(), JSLintPluginConstant.EXTENTION_JS)) { Parser parser = JsParserFactory.createParser(resource); try { parser.parse(new NullProgressMonitor()); } catch (InterruptedException e) { // ignore } } }
From source file:com.haulmont.cuba.gui.components.AbstractAction.java
@Override public void setCaption(String caption) { String oldValue = this.caption; if (!StringUtils.equals(oldValue, caption)) { this.caption = caption; firePropertyChange(PROP_CAPTION, oldValue, caption); }/* w w w . j a v a 2 s.c o m*/ }
From source file:com.funambol.framework.tools.beans.SimpleLazyInitBean.java
@Override public boolean equals(Object o) { if (!(o instanceof SimpleLazyInitBean)) { return false; }/*from w w w.jav a 2s.c om*/ SimpleLazyInitBean clBean = (SimpleLazyInitBean) o; return (StringUtils.equals(prop1, clBean.prop1) && StringUtils.equals(prop2, clBean.prop2) && initialized == clBean.initialized); }
From source file:com.mirth.connect.model.ncpdp.NCPDPReference.java
public String getSegment(String key, String version) { if (StringUtils.equals(version, VERSION_D0)) { return MapUtils.getString(segmentD0Map, key, key); } else {//from w w w. ja v a 2 s.co m return MapUtils.getString(segment51Map, key, key); } }