remove unused setters and use guava style equals, hashCode and toString methods

This commit is contained in:
Sebastian Sdorra
2014-04-13 15:30:49 +02:00
parent b900aa29f8
commit b9cfd7ff24
3 changed files with 32 additions and 80 deletions

View File

@@ -33,6 +33,10 @@
package sonia.scm.plugin;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.io.Serializable;
@@ -53,7 +57,7 @@ public class PluginRepository implements Serializable
* Constructs ...
*
*/
public PluginRepository() {}
PluginRepository() {}
/**
* Constructs ...
@@ -93,21 +97,7 @@ public class PluginRepository implements Serializable
final PluginRepository other = (PluginRepository) obj;
if ((this.id == null)
? (other.id != null)
: !this.id.equals(other.id))
{
return false;
}
if ((this.url == null)
? (other.url != null)
: !this.url.equals(other.url))
{
return false;
}
return true;
return Objects.equal(id, other.id) && Objects.equal(url, other.url);
}
/**
@@ -119,16 +109,7 @@ public class PluginRepository implements Serializable
@Override
public int hashCode()
{
int hash = 7;
hash = 37 * hash + ((this.id != null)
? this.id.hashCode()
: 0);
hash = 37 * hash + ((this.url != null)
? this.url.hashCode()
: 0);
return hash;
return Objects.hashCode(id, url);
}
/**
@@ -140,11 +121,8 @@ public class PluginRepository implements Serializable
@Override
public String toString()
{
StringBuilder out = new StringBuilder("PluginRepository{id=");
out.append(id).append(", url=").append(url).append(")");
return out.toString();
return Objects.toStringHelper(this).add("id", id).add("url",
url).toString();
}
//~--- get methods ----------------------------------------------------------
@@ -171,30 +149,6 @@ public class PluginRepository implements Serializable
return url;
}
//~--- set methods ----------------------------------------------------------
/**
* Method description
*
*
* @param id
*/
public void setId(String id)
{
this.id = id;
}
/**
* Method description
*
*
* @param url
*/
public void setUrl(String url)
{
this.url = url;
}
//~--- fields ---------------------------------------------------------------
/** Field description */

View File

@@ -53,6 +53,28 @@ import javax.xml.bind.annotation.XmlElement;
public class PluginResources
{
/**
* Constructs ...
*
*/
PluginResources() {}
/**
* Constructs ...
*
*
* @param scriptResources
* @param stylesheetResources
*/
public PluginResources(Set<String> scriptResources,
Set<String> stylesheetResources)
{
this.scriptResources = scriptResources;
this.stylesheetResources = stylesheetResources;
}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
@@ -133,30 +155,6 @@ public class PluginResources
return stylesheetResources;
}
//~--- set methods ----------------------------------------------------------
/**
* Method description
*
*
* @param scriptResources
*/
public void setScriptResources(Set<String> scriptResources)
{
this.scriptResources = scriptResources;
}
/**
* Method description
*
*
* @param stylesheetResources
*/
public void setStylesheetResources(Set<String> stylesheetResources)
{
this.stylesheetResources = stylesheetResources;
}
//~--- fields ---------------------------------------------------------------
/** Field description */

View File

@@ -70,5 +70,5 @@ public enum PluginState
//~--- fields ---------------------------------------------------------------
/** Field description */
int compareValue;
private final int compareValue;
}