/*
- * Sone - DefaultOwnIdentity.java - Copyright © 2010–2013 David Roden
+ * Sone - DefaultOwnIdentity.java - Copyright © 2010–2019 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
package net.pterodactylus.sone.freenet.wot;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* An own identity is an identity that the owner of the node has full control
* over.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public class DefaultOwnIdentity extends DefaultIdentity implements OwnIdentity {
*/
public DefaultOwnIdentity(String id, String nickname, String requestUri, String insertUri) {
super(id, nickname, requestUri);
- this.insertUri = insertUri;
- }
-
- /**
- * Copy constructor for an own identity.
- *
- * @param ownIdentity
- * The own identity to copy
- */
- public DefaultOwnIdentity(OwnIdentity ownIdentity) {
- super(ownIdentity.getId(), ownIdentity.getNickname(), ownIdentity.getRequestUri());
- this.insertUri = ownIdentity.getInsertUri();
- setContexts(ownIdentity.getContexts());
- setProperties(ownIdentity.getProperties());
+ this.insertUri = checkNotNull(insertUri);
}
//
// ACCESSORS
//
- /**
- * {@inheritDoc}
- */
@Override
public String getInsertUri() {
return insertUri;
}
+ @Override
+ public OwnIdentity addContext(String context) {
+ return (OwnIdentity) super.addContext(context);
+ }
+
+ @Override
+ public OwnIdentity removeContext(String context) {
+ return (OwnIdentity) super.removeContext(context);
+ }
+
+ @Override
+ public OwnIdentity setProperty(String name, String value) {
+ return (OwnIdentity) super.setProperty(name, value);
+ }
+
+ @Override
+ public OwnIdentity removeProperty(String name) {
+ return (OwnIdentity) super.removeProperty(name);
+ }
+
+ //
+ // OBJECT METHODS
+ //
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ return super.equals(object);
+ }
+
}