summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescription.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2017-04-10 16:40:33 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2017-04-10 16:40:33 -0400
commit889fac2bdf993dc86f64a8893c0260fdcf848acb (patch)
tree99ed08552efa86fdc5fdf4ddb8720d10e599fafe /BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescription.java
parent1656b02144446aeedebb3d1179e07ed99c01861c (diff)
Cleanup
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescription.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescription.java62
1 files changed, 32 insertions, 30 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescription.java b/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescription.java
index b750848..28f81d1 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescription.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/components/ComponentDescription.java
@@ -7,29 +7,30 @@ package bjc.utils.components;
*
*/
public class ComponentDescription implements IDescribedComponent {
- private static void sanityCheckArgs(String name, String author, String description, int version) {
- if(name == null)
+ private static void sanityCheckArgs(final String name, final String author, final String description,
+ final int version) {
+ if (name == null)
throw new NullPointerException("Component name can't be null");
- else if(version <= 0) throw new IllegalArgumentException("Component version must be greater than 0");
+ else if (version <= 0) throw new IllegalArgumentException("Component version must be greater than 0");
}
/**
* The author of the component
*/
- private String author;
+ private final String author;
/**
* The description of the component
*/
- private String description;
+ private final String description;
/**
* The name of the component
*/
- private String name;
+ private final String name;
/**
* The version of the component
*/
- private int version;
+ private final int version;
/**
* Create a new component description
@@ -45,7 +46,8 @@ public class ComponentDescription implements IDescribedComponent {
* @throws IllegalArgumentException
* thrown if version is less than 1
*/
- public ComponentDescription(String name, String author, String description, int version) {
+ public ComponentDescription(final String name, final String author, final String description,
+ final int version) {
sanityCheckArgs(name, author, description, version);
this.name = name;
@@ -56,14 +58,14 @@ public class ComponentDescription implements IDescribedComponent {
@Override
public String getAuthor() {
- if(author == null) return IDescribedComponent.super.getAuthor();
+ if (author == null) return IDescribedComponent.super.getAuthor();
return author;
}
@Override
public String getDescription() {
- if(description == null) return IDescribedComponent.super.getDescription();
+ if (description == null) return IDescribedComponent.super.getDescription();
return description;
}
@@ -85,7 +87,7 @@ public class ComponentDescription implements IDescribedComponent {
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#hashCode()
*/
@Override
@@ -93,9 +95,9 @@ public class ComponentDescription implements IDescribedComponent {
final int prime = 31;
int result = 1;
- result = prime * result + ((author == null) ? 0 : author.hashCode());
- result = prime * result + ((description == null) ? 0 : description.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + (author == null ? 0 : author.hashCode());
+ result = prime * result + (description == null ? 0 : description.hashCode());
+ result = prime * result + (name == null ? 0 : name.hashCode());
result = prime * result + version;
return result;
@@ -103,30 +105,30 @@ public class ComponentDescription implements IDescribedComponent {
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(Object obj) {
- if(this == obj) return true;
- if(obj == null) return false;
- if(getClass() != obj.getClass()) return false;
+ public boolean equals(final Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
- ComponentDescription other = (ComponentDescription) obj;
+ final ComponentDescription other = (ComponentDescription) obj;
- if(author == null) {
- if(other.author != null) return false;
- } else if(!author.equals(other.author)) return false;
+ if (author == null) {
+ if (other.author != null) return false;
+ } else if (!author.equals(other.author)) return false;
- if(description == null) {
- if(other.description != null) return false;
- } else if(!description.equals(other.description)) return false;
+ if (description == null) {
+ if (other.description != null) return false;
+ } else if (!description.equals(other.description)) return false;
- if(name == null) {
- if(other.name != null) return false;
- } else if(!name.equals(other.name)) return false;
+ if (name == null) {
+ if (other.name != null) return false;
+ } else if (!name.equals(other.name)) return false;
- if(version != other.version) return false;
+ if (version != other.version) return false;
return true;
}