org.bedework.util.misc.Util.checkNull()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中org.bedework.util.misc.Util.checkNull()方法的一些代码示例,展示了Util.checkNull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.checkNull()方法的具体详情如下:
包路径:org.bedework.util.misc.Util
类名称:Util
方法名:checkNull

Util.checkNull介绍

暂无

代码示例

代码示例来源:origin: org.bedework/bw-util-servlet

  1. /** Get a request parameter stripped of white space. Return null for zero
  2. * length.
  3. *
  4. * @param name name of parameter
  5. * @return String value
  6. */
  7. public String getReqPar(final String name) {
  8. return Util.checkNull(request.getParameter(name));
  9. }

代码示例来源:origin: org.bedework/bw-util-servlet

  1. /** Get a request parameter stripped of white space. Return default for null
  2. * or zero length.
  3. *
  4. * @param name name of parameter
  5. * @param def default value
  6. * @return String value
  7. */
  8. public String getReqPar(final String name, final String def) {
  9. final String s = Util.checkNull(request.getParameter(name));
  10. if (s != null) {
  11. return s;
  12. }
  13. return def;
  14. }

代码示例来源:origin: org.bedework/bw-util-servlet

  1. /** Get a multi-valued request parameter stripped of white space.
  2. * Return null for zero length.
  3. *
  4. * @param name name of parameter
  5. * @return List<String> or null
  6. * @throws Throwable
  7. */
  8. public List<String> getReqPars(final String name) throws Throwable {
  9. String[] s = request.getParameterValues(name);
  10. ArrayList<String> res = null;
  11. if ((s == null) || (s.length == 0)) {
  12. return null;
  13. }
  14. for (String par: s) {
  15. par = Util.checkNull(par);
  16. if (par != null) {
  17. if (res == null) {
  18. res = new ArrayList<>();
  19. }
  20. res.add(par);
  21. }
  22. }
  23. return res;
  24. }

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-facade

  1. /** Set the calendar color property
  2. *
  3. * @param val
  4. */
  5. public void setColor(final String val) {
  6. if (Util.checkNull(val) == null) {
  7. BwProperty p = findProperty(AppleIcalTags.calendarColor.getLocalPart());
  8. if (p != null) {
  9. removeProperty(p);
  10. }
  11. } else {
  12. setProperty(AppleIcalTags.calendarColor.getLocalPart(), val);
  13. }
  14. }

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-facade

  1. /** Set the event list
  2. *
  3. * @param val
  4. */
  5. public void setSubscriptionId(final String val) {
  6. if (Util.checkNull(val) == null) {
  7. BwProperty p = findProperty(subscriptionIdProperty);
  8. if (p != null) {
  9. removeProperty(p);
  10. }
  11. } else {
  12. setProperty(subscriptionIdProperty, val);
  13. }
  14. }

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-facade

  1. /** Check this is properly trimmed
  2. *
  3. * @return boolean true if changed
  4. */
  5. public boolean checkNulls() {
  6. boolean changed = false;
  7. String str = Util.checkNull(getName());
  8. if (CalFacadeUtil.compareStrings(str, getName()) != 0) {
  9. setName(str);
  10. changed = true;
  11. }
  12. str = Util.checkNull(getValue());
  13. if (CalFacadeUtil.compareStrings(str, getValue()) != 0) {
  14. setValue(str);
  15. changed = true;
  16. }
  17. return changed;
  18. }

代码示例来源:origin: org.bedework.caleng/bw-calendar-engine-facade

  1. /** Check this is properly trimmed
  2. *
  3. * @return boolean true if changed
  4. */
  5. public boolean checkNulls() {
  6. boolean changed = false;
  7. String str = Util.checkNull(getLang());
  8. if (CalFacadeUtil.compareStrings(str, getLang()) != 0) {
  9. setLang(str);
  10. changed = true;
  11. }
  12. str = Util.checkNull(getValue());
  13. if (CalFacadeUtil.compareStrings(str, getValue()) != 0) {
  14. setValue(str);
  15. changed = true;
  16. }
  17. return changed;
  18. }

相关文章