本文整理了Java中org.dataconservancy.model.dcs.support.Util.isEmptyOrNull()
方法的一些代码示例,展示了Util.isEmptyOrNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.isEmptyOrNull()
方法的具体详情如下:
包路径:org.dataconservancy.model.dcs.support.Util
类名称:Util
方法名:isEmptyOrNull
[英]Returns true if s
is empty or null
.
[中]如果s
为空或null
,则返回true。
代码示例来源:origin: org.dataconservancy.model/dcs-model
/**
* Throws {@link IllegalArgumentException} if <code>s</code> is <code>null</code> or the empty string.
*
* @param s a string
* @return the string
*/
static public String notEmptyOrNull(String s) {
final String msg = "String must not be empty or null.";
if (Util.isEmptyOrNull(s)) {
throw new IllegalArgumentException(msg);
}
return s;
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-ui-model-builder-xstream
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
DateTime date = null;
String value = reader.getValue();
if (!isEmptyOrNull(value)) {
date = fmt.parseDateTime(value);
}
return date;
}
代码示例来源:origin: org.dataconservancy.model/dcs-ui-model-builder-xstream
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
DateTime date = null;
String value = reader.getValue();
if (!isEmptyOrNull(value)) {
date = fmt.parseDateTime(value);
}
return date;
}
代码示例来源:origin: org.dataconservancy.model/dcs-ui-model-builder-xstream
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
DateTime date = null;
String value = reader.getValue();
if (!isEmptyOrNull(value)) {
date = fmt.parseDateTime(value);
}
return date;
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-ui-model-builder-xstream
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
DateTime date = null;
String value = reader.getValue();
if (!isEmptyOrNull(value)) {
date = fmt.parseDateTime(value);
}
return date;
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-gqm-builder-xstream
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
String start = reader.getAttribute(A_START);
String end = reader.getAttribute(A_END);
long startVal = -1;
if( !isEmptyOrNull(start)){
startVal = Long.parseLong(start);
}
long endVal = -1;
if( !isEmptyOrNull(end)){
endVal = Long.parseLong(end);
}
DateTimeInterval interval = new DateTimeInterval(startVal, endVal);
return interval;
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-gqm-builder-xstream
@Override
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context){
super.marshal(source, writer, context);
Relation relation = (Relation) source;
if( !isEmptyOrNull(relation.getObject())) {
writer.addAttribute(A_OBJECT, relation.getObject());
}
if( !isEmptyOrNull(relation.getPredicate().toString())){
writer.addAttribute(A_PREDICATE, relation.getPredicate().toString());
}
}
代码示例来源:origin: org.dataconservancy.model/dcs-model-builder-xstream
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
final DcsFixity fixity = new DcsFixity();
final String algo = reader.getAttribute(A_ALGO);
final String value = reader.getValue();
// inside the <fixity> element
if (!isEmptyOrNull(algo)) {
fixity.setAlgorithm(algo);
}
if (!isEmptyOrNull(value)) {
fixity.setValue(value);
}
return fixity;
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-model-builder-xstream
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
final DcsFixity fixity = new DcsFixity();
final String algo = reader.getAttribute(A_ALGO);
final String value = reader.getValue();
// inside the <fixity> element
if (!isEmptyOrNull(algo)) {
fixity.setAlgorithm(algo);
}
if (!isEmptyOrNull(value)) {
fixity.setValue(value);
}
return fixity;
}
代码示例来源:origin: org.dataconservancy.model/dcs-ui-model-builder-xstream
@Override
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
super.marshal(source, writer, context);
final Relationship relationship = (Relationship) source;
if (!isEmptyOrNull(relationship.getSubject())) {
writer.addAttribute(A_RELATIONSHIP_SUBJECT, relationship.getSubject());
}
if (!isEmptyOrNull(relationship.getPredicate().toString())) {
writer.addAttribute(A_RELATIONSHIP_PREDICATE, relationship.getPredicate().toString());
}
if (!isEmptyOrNull(relationship.getObject())) {
writer.addAttribute(A_RELATIONSHIP_OBJECT, relationship.getObject());
}
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-ui-model-builder-xstream
@Override
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
super.marshal(source, writer, context);
final Relationship relationship = (Relationship) source;
if (!isEmptyOrNull(relationship.getSubject())) {
writer.addAttribute(A_RELATIONSHIP_SUBJECT, relationship.getSubject());
}
if (!isEmptyOrNull(relationship.getPredicate().toString())) {
writer.addAttribute(A_RELATIONSHIP_PREDICATE, relationship.getPredicate().toString());
}
if (!isEmptyOrNull(relationship.getObject())) {
writer.addAttribute(A_RELATIONSHIP_OBJECT, relationship.getObject());
}
}
代码示例来源:origin: org.dataconservancy.model/dcs-model-builder-xstream
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
final DcsRelation rel = new DcsRelation();
final String relUri = reader.getAttribute(A_REL);
final String ref = reader.getAttribute(A_REF);
if (!isEmptyOrNull(relUri)) {
rel.setRelUri(relUri);
}
if (!isEmptyOrNull(ref)) {
rel.setRef(new DcsEntityReference(ref));
}
return rel;
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-model-builder-xstream
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
final DcsRelation rel = new DcsRelation();
final String relUri = reader.getAttribute(A_REL);
final String ref = reader.getAttribute(A_REF);
if (!isEmptyOrNull(relUri)) {
rel.setRelUri(relUri);
}
if (!isEmptyOrNull(ref)) {
rel.setRef(new DcsEntityReference(ref));
}
return rel;
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-gqm-builder-xstream
@Override
public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) {
final String object = reader.getAttribute(A_OBJECT);
URI predicate = null;
if(!isEmptyOrNull(reader.getAttribute(A_PREDICATE))){
try {
predicate = new URI(reader.getAttribute(A_PREDICATE));
} catch (URISyntaxException e) {
}
}
return new Relation(predicate, object);
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-model-builder-xstream
@Override
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
super.marshal(source, writer, context);
final DcsFixity fixity = (DcsFixity) source;
if (!isEmptyOrNull(fixity.getAlgorithm())) {
writer.addAttribute(A_ALGO, fixity.getAlgorithm());
}
if (!isEmptyOrNull(fixity.getValue())) {
writer.setValue(fixity.getValue());
}
}
代码示例来源:origin: org.dataconservancy.model/dcs-model-builder-xstream
@Override
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
super.marshal(source, writer, context);
final DcsFixity fixity = (DcsFixity) source;
if (!isEmptyOrNull(fixity.getAlgorithm())) {
writer.addAttribute(A_ALGO, fixity.getAlgorithm());
}
if (!isEmptyOrNull(fixity.getValue())) {
writer.setValue(fixity.getValue());
}
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-pkg-model-builder-xstream
@Override
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
super.marshal(source, writer, context);
final Checksum checksum = (Checksum) source;
if (!isEmptyOrNull(checksum.getAlgorithm())) {
writer.addAttribute(A_ALGORITHM, checksum.getAlgorithm());
}
if (!isEmptyOrNull(checksum.getValue())) {
writer.addAttribute(A_VALUE, checksum.getValue());
}
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-pkg-model-builder-xstream
@Override
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
super.marshal(source, writer, context);
final Triple triple = (Triple) source;
if (!isEmptyOrNull(triple.getSubject())) {
writer.addAttribute(A_SUBJECT, triple.getSubject());
}
if (!isEmptyOrNull(triple.getPredicate())) {
writer.addAttribute(A_PREDICATE, triple.getPredicate());
}
if (!isEmptyOrNull(triple.getObject())) {
writer.addAttribute(A_OBJECT, triple.getObject());
}
}
代码示例来源:origin: org.dataconservancy.model/dcs-model-builder-xstream
@Override
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
super.marshal(source, writer, context);
final DcsRelation rel = (DcsRelation) source;
if (rel.getRef() != null) {
writer.addAttribute(A_REF, rel.getRef().getRef());
}
if (!isEmptyOrNull(rel.getRelUri())) {
writer.addAttribute(A_REL, rel.getRelUri());
}
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-model-builder-xstream
@Override
public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
super.marshal(source, writer, context);
final DcsRelation rel = (DcsRelation) source;
if (rel.getRef() != null) {
writer.addAttribute(A_REF, rel.getRef().getRef());
}
if (!isEmptyOrNull(rel.getRelUri())) {
writer.addAttribute(A_REL, rel.getRelUri());
}
}
内容来源于网络,如有侵权,请联系作者删除!