本文整理了Java中org.apache.cayenne.util.Util.nullSafeCompare()
方法的一些代码示例,展示了Util.nullSafeCompare()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.nullSafeCompare()
方法的具体详情如下:
包路径:org.apache.cayenne.util.Util
类名称:Util
方法名:nullSafeCompare
[英]Compares two objects similar to "Comparable.compareTo(Object)". Unlike Comparable.compareTo(..), this method doesn't throw an exception if any of the two objects is null.
[中]
代码示例来源:origin: org.apache.cayenne/cayenne-nodeps
public int compare(Object o1, Object o2) {
String name1 = (o1 != null) ? ((DataNode) o1).getName() : null;
String name2 = (o1 != null) ? ((DataNode) o2).getName() : null;
return Util.nullSafeCompare(true, name1, name2);
}
});
代码示例来源:origin: org.apache.cayenne/cayenne-nodeps
public int compare(Object o1, Object o2) {
String name1 = (o1 != null) ? ((DataMap) o1).getName() : null;
String name2 = (o1 != null) ? ((DataMap) o2).getName() : null;
return Util.nullSafeCompare(true, name1, name2);
}
});
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
public int compare(Object o1, Object o2) {
EmbeddableAttribute a1 = (EmbeddableAttribute) o1;
EmbeddableAttribute a2 = (EmbeddableAttribute) o2;
int delta = getWeight(a1) - getWeight(a2);
return (delta != 0) ? delta : Util.nullSafeCompare(true, a1.getName(), a2
.getName());
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
public int compare(ObjRelationship o1, ObjRelationship o2) {
int delta = getWeight(o1) - getWeight(o2);
return (delta != 0) ? delta : Util.nullSafeCompare(true, o1.getName(), o2.getName());
}
代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler
public int compare(Object o1, Object o2) {
Attribute a1 = ((ObjAttributeWrapper) o1).getValue();
Attribute a2 = ((ObjAttributeWrapper) o2).getValue();
int delta = getWeight(a1) - getWeight(a2);
return (delta != 0) ? delta : Util.nullSafeCompare(true, a1.getName(), a2
.getName());
}
内容来源于网络,如有侵权,请联系作者删除!