本文整理汇总了Java中ca.nrc.cadc.util.StringUtil类的典型用法代码示例。如果您正苦于以下问题:Java StringUtil类的具体用法?Java StringUtil怎么用?Java StringUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringUtil类属于ca.nrc.cadc.util包,在下文中一共展示了StringUtil类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGroupName
import ca.nrc.cadc.util.StringUtil; //导入依赖的package包/类
public final String getGroupName() {
// canonical form: ivo://<authority>/<path>?<name>
String ret = groupID.getQuery();
if (StringUtil.hasText(ret)) {
return ret;
}
// backwards compat
ret = groupID.getFragment();
if (StringUtil.hasText(ret)) {
return ret;
}
// temporary backwards compat for caom2ac usage hack
return groupID.toASCIIString();
}
示例2: validateProposalGroup
import ca.nrc.cadc.util.StringUtil; //导入依赖的package包/类
private static void validateProposalGroup(boolean proposalGroup, String staffGroup) {
if (proposalGroup) {
if (!StringUtil.hasText(staffGroup)) {
throw new IllegalArgumentException("staff group is not specified for proposal group");
}
}
}
示例3: decodeStates
import ca.nrc.cadc.util.StringUtil; //导入依赖的package包/类
public static void decodeStates(String val, List<PolarizationState> out) {
if (val == null) {
return;
}
String[] ss = val.split(POL_STATE_SEPARATOR);
for (String s : ss) {
if (StringUtil.hasText(s)) {
PolarizationState ps = PolarizationState.toValue(s);
out.add(ps);
}
}
}
示例4: ObservationWriter
import ca.nrc.cadc.util.StringUtil; //导入依赖的package包/类
/**
* Constructor. This uses the specified CAOM namespace prefix (null is not
* allowed). If writeEmptyCollections is true, empty elements will be
* included for any collections that are empty; this is not necessary but is
* valid in the schema so is useful for testing.
*
* @param caom2NamespacePrefix
* @param namespace
* a valid CAOM-2.x target namespace
* @param writeEmptyCollections
*/
public ObservationWriter(String caom2NamespacePrefix, String namespace,
boolean writeEmptyCollections) {
this.writeEmptyCollections = writeEmptyCollections;
if (!StringUtil.hasText(caom2NamespacePrefix)) {
throw new IllegalArgumentException(
"null or 0-length namespace prefix is not allowed: "
+ caom2NamespacePrefix);
}
if (namespace == null) {
namespace = XmlConstants.CAOM2_3_NAMESPACE; // default
log.debug("default namespace: " + namespace);
}
if (XmlConstants.CAOM2_3_NAMESPACE.equals(namespace)) {
this.caom2Namespace = Namespace.getNamespace(caom2NamespacePrefix,
XmlConstants.CAOM2_3_NAMESPACE);
docVersion = 23;
} else if (XmlConstants.CAOM2_2_NAMESPACE.equals(namespace)) {
this.caom2Namespace = Namespace.getNamespace(caom2NamespacePrefix,
XmlConstants.CAOM2_2_NAMESPACE);
docVersion = 22;
} else if (XmlConstants.CAOM2_1_NAMESPACE.equals(namespace)) {
this.caom2Namespace = Namespace.getNamespace(caom2NamespacePrefix,
XmlConstants.CAOM2_1_NAMESPACE);
docVersion = 21;
} else if (XmlConstants.CAOM2_0_NAMESPACE.equals(namespace)) {
this.caom2Namespace = Namespace.getNamespace(caom2NamespacePrefix,
XmlConstants.CAOM2_0_NAMESPACE);
docVersion = 20;
} else {
throw new IllegalArgumentException(
"invalid namespace: " + namespace);
}
this.xsiNamespace = Namespace.getNamespace("xsi",
XmlConstants.XMLSCHEMA);
log.debug("output version: " + docVersion + " "
+ caom2Namespace.getPrefix() + " -> "
+ caom2Namespace.getURI());
}