jodd.util.Util.toString()方法的使用及代码示例

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

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

Util.toString介绍

[英]Returns string representation of an object, while checking for null.
[中]

代码示例

代码示例来源:origin: oblac/jodd

public XmlDeclaration(final Document ownerDocument, final CharSequence version, final CharSequence encoding, final CharSequence standalone) {
  super(ownerDocument, NodeType.XML_DECLARATION, "xml");
  this.version = Util.toString(version);
  this.encoding = Util.toString(encoding);
  this.standalone = Util.toString(standalone);
}

代码示例来源:origin: oblac/jodd

@Override
public void doctype(final Doctype doctype) {
  if (!enabled) {
    return;
  }
  DocumentType documentType = new DocumentType(rootNode,
      Util.toString(doctype.getName()),
      Util.toString(doctype.getPublicIdentifier()),
      Util.toString(doctype.getSystemIdentifier())
  );
  parentNode.addChild(documentType);
}

代码示例来源:origin: oblac/jodd

public Element(final Document ownerNode, final Tag tag, final boolean voidElement, final boolean selfClosed) {
  super(ownerNode, NodeType.ELEMENT, Util.toString(tag.getName()));
  this.voidElement = voidElement;
  this.selfClosed = selfClosed;
  this.rawTag = tag.isRawTag();
  int attrCount = tag.getAttributeCount();
  for (int i = 0; i < attrCount; i++) {
    String key = Util.toString(tag.getAttributeName(i));
    String value = Util.toString(tag.getAttributeValue(i));
    setAttribute(key, value);
  }
}

代码示例来源:origin: oblac/jodd

@Test
void testToString() {
  assertNull(Util.toString(null));
  assertEquals("abcd", Util.toString("abcd"));
  assertEquals("1234", Util.toString(1234));
  assertEquals("1234.0", Util.toString(1234d));
}

代码示例来源:origin: oblac/jodd

@Override
public void tag(final Tag tag) {
  if (!insideConditionalComment) {
    if (tag.nameEquals(T_LINK)) {
      CharSequence type = tag.getAttributeValue("type");
      if (type != null && CharSequenceUtil.equalsIgnoreCase(type, "text/css")) {
        String media = Util.toString(tag.getAttributeValue("media"));
        if (media == null || media.contains("screen")) {
          String href = Util.toString(tag.getAttributeValue("href"));
          if (cssBundleAction.acceptLink(href)) {
            String link = cssBundleAction.processLink(href);
            if (link != null) {
              tag.setAttribute("href", link);
              super.tag(tag);
            }
            return;
          }
        }
      }
    }
  }
  super.tag(tag);
}

代码示例来源:origin: oblac/jodd

@Override
public void script(final Tag tag, final CharSequence body) {
  if (!insideConditionalComment) {
    String src = Util.toString(tag.getAttributeValue("src"));
    if (src == null) {
      super.script(tag, body);
      return;
    }
    if (jsBundleAction.acceptLink(src)) {
      String link = jsBundleAction.processLink(src);
      if (link != null) {
        tag.setAttributeValue("src", link);
        super.script(tag, body);
      }
      return;
    }
  }
  super.script(tag, body);
}

代码示例来源:origin: org.jodd/jodd-lagarto

public XmlDeclaration(final Document ownerDocument, final CharSequence version, final CharSequence encoding, final CharSequence standalone) {
  super(ownerDocument, NodeType.XML_DECLARATION, "xml");
  this.version = Util.toString(version);
  this.encoding = Util.toString(encoding);
  this.standalone = Util.toString(standalone);
}

代码示例来源:origin: fivesmallq/web-data-extractor

public XmlDeclaration(Document ownerDocument, CharSequence version, CharSequence encoding, CharSequence standalone) {
  super(ownerDocument, NodeType.XML_DECLARATION, "xml");
  this.version = Util.toString(version);
  this.encoding = Util.toString(encoding);
  this.standalone = Util.toString(standalone);
}

代码示例来源:origin: org.jodd/jodd-lagarto

@Override
public void doctype(final Doctype doctype) {
  if (!enabled) {
    return;
  }
  DocumentType documentType = new DocumentType(rootNode,
      Util.toString(doctype.getName()),
      Util.toString(doctype.getPublicIdentifier()),
      Util.toString(doctype.getSystemIdentifier())
  );
  parentNode.addChild(documentType);
}

代码示例来源:origin: fivesmallq/web-data-extractor

public void doctype(Doctype doctype) {
  if (!enabled) {
    return;
  }
  DocumentType documentType = new DocumentType(rootNode,
      Util.toString(doctype.getName()),
      Util.toString(doctype.getPublicIdentifier()),
      Util.toString(doctype.getSystemIdentifier())
  );
  parentNode.addChild(documentType);
}

代码示例来源:origin: fivesmallq/web-data-extractor

public Element(Document ownerNode, Tag tag, boolean voidElement, boolean selfClosed) {
  super(ownerNode, NodeType.ELEMENT, Util.toString(tag.getName()));
  this.voidElement = voidElement;
  this.selfClosed = selfClosed;
  this.rawTag = tag.isRawTag();
  int attrCount = tag.getAttributeCount();
  for (int i = 0; i < attrCount; i++) {
    String key = Util.toString(tag.getAttributeName(i));
    String value = Util.toString(tag.getAttributeValue(i));
    setAttribute(key, value);
  }
}

代码示例来源:origin: org.jodd/jodd-lagarto

public Element(final Document ownerNode, final Tag tag, final boolean voidElement, final boolean selfClosed) {
  super(ownerNode, NodeType.ELEMENT, Util.toString(tag.getName()));
  this.voidElement = voidElement;
  this.selfClosed = selfClosed;
  this.rawTag = tag.isRawTag();
  int attrCount = tag.getAttributeCount();
  for (int i = 0; i < attrCount; i++) {
    String key = Util.toString(tag.getAttributeName(i));
    String value = Util.toString(tag.getAttributeValue(i));
    setAttribute(key, value);
  }
}

代码示例来源:origin: org.jodd/jodd-htmlstapler

@Override
public void tag(final Tag tag) {
  if (!insideConditionalComment) {
    if (tag.nameEquals(T_LINK)) {
      CharSequence type = tag.getAttributeValue("type");
      if (type != null && CharSequenceUtil.equalsIgnoreCase(type, "text/css")) {
        String media = Util.toString(tag.getAttributeValue("media"));
        if (media == null || media.contains("screen")) {
          String href = Util.toString(tag.getAttributeValue("href"));
          if (cssBundleAction.acceptLink(href)) {
            String link = cssBundleAction.processLink(href);
            if (link != null) {
              tag.setAttribute("href", link);
              super.tag(tag);
            }
            return;
          }
        }
      }
    }
  }
  super.tag(tag);
}

代码示例来源:origin: org.jodd/jodd-htmlstapler

@Override
public void script(final Tag tag, final CharSequence body) {
  if (!insideConditionalComment) {
    String src = Util.toString(tag.getAttributeValue("src"));
    if (src == null) {
      super.script(tag, body);
      return;
    }
    if (jsBundleAction.acceptLink(src)) {
      String link = jsBundleAction.processLink(src);
      if (link != null) {
        tag.setAttributeValue("src", link);
        super.script(tag, body);
      }
      return;
    }
  }
  super.script(tag, body);
}

相关文章