LinkedEntity is now comparable
This commit is contained in:
parent
c0c36bdf9c
commit
de1bb75c56
|
@ -117,4 +117,48 @@ public final class LinkedEntityImpl extends PropertyElementImpl implements Linke
|
|||
Objects.equals(description, other.description);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(LinkedEntity other) {
|
||||
if (this == other) {
|
||||
return 0;
|
||||
}
|
||||
if (other == null) {
|
||||
return -1;
|
||||
}
|
||||
if (getClass() != other.getClass()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
LinkedEntityImpl o = (LinkedEntityImpl) other;
|
||||
|
||||
int ret = 0;
|
||||
ret = source.compareTo(o.source);
|
||||
if(ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = relation.compareTo(o.relation);
|
||||
if(ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = target.compareTo(o.target);
|
||||
if(ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = max.compareTo(o.max);
|
||||
if(ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = min.compareTo(o.min);
|
||||
if(ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return description.compareTo(o.description);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.gcube.informationsystem.utils.Version;
|
|||
@JsonDeserialize(as=LinkedEntityImpl.class)
|
||||
@TypeMetadata(name = LinkedEntity.NAME, description = " A convenient type to define a Resource in terms of: mandatory/recommended ConsistsOf->Facets; suggested IsRelatedTo->Resource.", version = Version.MINIMAL_VERSION_STRING)
|
||||
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
||||
public interface LinkedEntity extends PropertyElement {
|
||||
public interface LinkedEntity extends PropertyElement, Comparable<LinkedEntity> {
|
||||
|
||||
public static final String NAME = "LinkedEntity"; // LinkedEntity.class.getSimpleName();
|
||||
|
||||
|
|
Loading…
Reference in New Issue