dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/oaf/AccessRight.java

50 lines
969 B
Java
Raw Normal View History

2021-04-23 14:03:59 +02:00
package eu.dnetlib.dhp.schema.oaf;
import java.util.Optional;
/**
* This class models the access rights of research products.
*/
public class AccessRight extends Qualifier {
private OpenAccessRoute openAccessRoute;
public OpenAccessRoute getOpenAccessRoute() {
return openAccessRoute;
}
public void setOpenAccessRoute(OpenAccessRoute openAccessRoute) {
this.openAccessRoute = openAccessRoute;
}
2021-08-10 09:36:37 +02:00
@Override
2021-04-23 14:03:59 +02:00
public String toComparableString() {
String s = super.toComparableString();
return Optional
.ofNullable(getOpenAccessRoute())
2021-05-14 11:06:24 +02:00
.map(x -> s + "::" + x)
2021-04-23 14:03:59 +02:00
.orElse(s);
}
@Override
public int hashCode() {
return toComparableString().hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Qualifier other = (Qualifier) obj;
return toComparableString().equals(other.toComparableString());
}
}