本文整理了Java中org.jdom2.Attribute.getBooleanValue()
方法的一些代码示例,展示了Attribute.getBooleanValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.getBooleanValue()
方法的具体详情如下:
包路径:org.jdom2.Attribute
类名称:Attribute
方法名:getBooleanValue
[英]This gets the effective boolean value of the attribute, or throws a DataConversionException
if a conversion can't be performed. True values are: "true", "on", "1", and "yes". False values are: "false", "off", "0", and "no". Values are trimmed before comparison. Values other than those listed here throw the exception.
[中]这将获取属性的有效布尔值,如果无法执行转换,则抛出DataConversionException
。真实值为:“真”、“开”、“1”和“是”。错误值为:“错误”、“关闭”、“0”和“否”。值在比较之前被修剪。此处列出的值以外的值引发异常。
代码示例来源:origin: rometools/rome
private Boolean parseBooleanAttr(final Element sharingChild, final String attrName) {
final Attribute attribute = sharingChild.getAttribute(attrName);
Boolean attrValue = null;
if (attribute != null) {
try {
attrValue = Boolean.valueOf(attribute.getBooleanValue());
} catch (final DataConversionException e) {
// dont use the data
}
}
return attrValue;
}
代码示例来源:origin: com.rometools/rome-modules
private Boolean parseBooleanAttr(final Element sharingChild, final String attrName) {
final Attribute attribute = sharingChild.getAttribute(attrName);
Boolean attrValue = null;
if (attribute != null) {
try {
attrValue = Boolean.valueOf(attribute.getBooleanValue());
} catch (final DataConversionException e) {
// dont use the data
}
}
return attrValue;
}
代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss
private Boolean parseBooleanAttr(Element sharingChild, String attrName) {
Attribute attribute = sharingChild.getAttribute(attrName);
Boolean attrValue = null;
if (attribute != null) {
try {
attrValue = Boolean.valueOf(attribute.getBooleanValue());
} catch (DataConversionException e) {
// dont use the data
}
}
return attrValue;
}
代码示例来源:origin: apache/marmotta
private Boolean parseBooleanAttr(Element sharingChild, String attrName) {
Attribute attribute = sharingChild.getAttribute(attrName);
Boolean attrValue = null;
if (attribute != null) {
try {
attrValue = attribute.getBooleanValue();
} catch (DataConversionException e) {
// dont use the data
}
}
return attrValue;
}
代码示例来源:origin: org.opencadc/cadc-uws
private String parseStringContent(Element e)
throws DataConversionException
{
if (e == null)
return null;
Attribute nil = e.getAttribute("nil", UWS.XSI_NS);
if (nil != null && nil.getBooleanValue())
return null;
return e.getTextTrim();
}
代码示例来源:origin: Unidata/thredds
private DatasetScanConfig.AddLatest readDatasetScanAddLatest(Element addLatestElem) {
String latestName = "latest.xml";
String serviceName = "Resolver";
boolean latestOnTop = true;
boolean isResolver = true;
String tmpLatestName = addLatestElem.getAttributeValue("name");
if (tmpLatestName != null)
latestName = tmpLatestName;
String tmpserviceName = addLatestElem.getAttributeValue("serviceName");
if (tmpserviceName != null)
serviceName = tmpserviceName;
// Does latest go on top or bottom of list.
Attribute topAtt = addLatestElem.getAttribute("top");
if (topAtt != null) {
try {
latestOnTop = topAtt.getBooleanValue();
} catch (DataConversionException e) {
latestOnTop = true;
}
}
// Get lastModifed limit.
String lastModLimitVal = addLatestElem.getAttributeValue("lastModifiedLimit");
long lastModLimit = -1;
if (lastModLimitVal != null)
lastModLimit = Long.parseLong(lastModLimitVal) * 60 * 1000; // convert minutes to millisecs
return new DatasetScanConfig.AddLatest(latestName, serviceName, latestOnTop, lastModLimit);
}
代码示例来源:origin: fiji/TrackMate
public static final boolean readBooleanAttribute(final Element element, final String name, final Logger logger) {
boolean val = false;
final Attribute att = element.getAttribute(name);
if (null == att) {
logger.error("Could not find attribute "+name+" for element "+element.getName()+", substituting default value.\n");
return val;
}
try {
val = att.getBooleanValue();
} catch (final DataConversionException e) {
logger.error("Cannot read the attribute "+name+" of the element "+element.getName()+", substituting default value.\n");
}
return val;
}
代码示例来源:origin: sc.fiji/TrackMate_
public static final boolean readBooleanAttribute(final Element element, final String name, final Logger logger) {
boolean val = false;
final Attribute att = element.getAttribute(name);
if (null == att) {
logger.error("Could not find attribute "+name+" for element "+element.getName()+", substituting default value.\n");
return val;
}
try {
val = att.getBooleanValue();
} catch (final DataConversionException e) {
logger.error("Cannot read the attribute "+name+" of the element "+element.getName()+", substituting default value.\n");
}
return val;
}
代码示例来源:origin: edu.ucar/cdm
if (topAtt != null) {
try {
latestOnTop = topAtt.getBooleanValue();
} catch (DataConversionException e) {
latestOnTop = true;
代码示例来源:origin: Unidata/thredds
if (topAtt != null) {
try {
latestOnTop = topAtt.getBooleanValue();
} catch (DataConversionException e) {
latestOnTop = true;
代码示例来源:origin: fiji/TrackMate
try
isInt = child.getAttribute( FEATURE_ISINT_ATTRIBUTE ).getBooleanValue();
代码示例来源:origin: edu.ucar/netcdf
latestOnTop = topAtt.getBooleanValue();
代码示例来源:origin: sc.fiji/TrackMate_
try
isInt = child.getAttribute( FEATURE_ISINT_ATTRIBUTE ).getBooleanValue();
代码示例来源:origin: sc.fiji/bigdataviewer_fiji
z = element.getAttribute( "Z", NAMESPACE ).getDoubleValue();
channel = element.getAttribute( "Ch", NAMESPACE ).getIntValue();
isMIP = element.getAttribute( "Mip", NAMESPACE ).getBooleanValue();
代码示例来源:origin: edu.ucar/cdm
if (topAtt != null) {
try {
latestOnTop = topAtt.getBooleanValue();
} catch (DataConversionException e) {
latestOnTop = true;
代码示例来源:origin: Unidata/thredds
if (topAtt != null) {
try {
latestOnTop = topAtt.getBooleanValue();
} catch (DataConversionException e) {
latestOnTop = true;
代码示例来源:origin: net.preibisch/multiview-reconstruction
try
cached = elem.getAttribute( CACHED_TAG ).getBooleanValue();
active = elem.getAttribute( ACTIVE_TAG ).getBooleanValue();
代码示例来源:origin: pwm-project/pwm
private static StoredChallengeItem parseResponseElement(
final Element responseElement,
final StoredResponseItem storedResponseItem
)
throws DataConversionException
{
/*
final boolean adminDefined = responseElement.getAttribute( XML_ATTRIBUTE_ADMIN_DEFINED ) != null
&& responseElement.getAttribute( XML_ATTRIBUTE_ADMIN_DEFINED ).getBooleanValue();
final int minLength = responseElement.getAttribute( XNL_ATTRIBUTE_MIN_LENGTH ) == null
? 0
: responseElement.getAttribute( XNL_ATTRIBUTE_MIN_LENGTH ).getIntValue();
final int maxLength = responseElement.getAttribute( XNL_ATTRIBUTE_MAX_LENGTH ) == null
? 0
: responseElement.getAttribute( XNL_ATTRIBUTE_MAX_LENGTH ).getIntValue();
*/
final boolean required = responseElement.getAttribute( XML_ATTRIBUTE_REQUIRED ) != null
&& responseElement.getAttribute( XML_ATTRIBUTE_REQUIRED ).getBooleanValue();
final String challengeText = responseElement.getChild( XML_NODE_CHALLENGE ) == null
? ""
: responseElement.getChild( XML_NODE_CHALLENGE ).getText();
return StoredChallengeItem.builder()
.responseLevel( required ? ResponseLevel.REQUIRED : ResponseLevel.RANDOM )
.questionText( challengeText )
.id( makeId( challengeText ) )
.answer( storedResponseItem )
.build();
}
代码示例来源:origin: ssaring/sportstracker
if (aRecDistance != null) {
try {
sportType.setRecordDistance(aRecDistance.getBooleanValue());
} catch (DataConversionException dce) {
throw new IllegalArgumentException("Failed to parse the record-distance of sport type with ID '" +
代码示例来源:origin: vasl-developers/vasl
hasHills = root.getAttribute(boardMetadataHasHillsAttr).getBooleanValue();
boardImageFileName = root.getAttributeValue(boardMetadataImageFileNameAttr);
name = root.getAttributeValue(boardMetadataNameAttr);
altHexGrain = root.getAttribute(boardMetadataAltHexGrainAttr).getBooleanValue();
内容来源于网络,如有侵权,请联系作者删除!