diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-10-08 22:39:59 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-10-08 22:39:59 -0300 |
| commit | c82e3b3b2de0633317ec8fc85925e91422820597 (patch) | |
| tree | 96567416ce23c5ce85601f9cedc3a94bb1c55cba /base/src/main/java/bjc/utils/components/IDescribedComponent.java | |
| parent | b3ac1c8690c3e14c879913e5dcc03a5f5e14876e (diff) | |
Start splitting into maven modules
Diffstat (limited to 'base/src/main/java/bjc/utils/components/IDescribedComponent.java')
| -rw-r--r-- | base/src/main/java/bjc/utils/components/IDescribedComponent.java | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/base/src/main/java/bjc/utils/components/IDescribedComponent.java b/base/src/main/java/bjc/utils/components/IDescribedComponent.java new file mode 100644 index 0000000..952b375 --- /dev/null +++ b/base/src/main/java/bjc/utils/components/IDescribedComponent.java @@ -0,0 +1,64 @@ +package bjc.utils.components; + +/** + * Represents a optional component that has status information associated with + * it + * + * @author ben + * + */ +public interface IDescribedComponent extends Comparable<IDescribedComponent> { + /** + * Get the author of this component + * + * Providing this is optional, with "Anonymous" as the default author + * + * @return The author of the component + */ + default String getAuthor() { + return "Anonymous"; + } + + /** + * Get the description of this component + * + * Providing this is optional, with the default being a note that no + * description was provided + * + * @return The description of the component + */ + default String getDescription() { + return "No description provided."; + } + + /** + * Get the name of this component. + * + * This is the only thing required of all components + * + * @return The name of the component + */ + String getName(); + + /** + * Get the version of this component + * + * Providing this is optional, with "1" as the default version + * + * @return The version of this component + */ + default int getVersion() { + return 1; + } + + @Override + default int compareTo(final IDescribedComponent o) { + int res = getName().compareTo(o.getName()); + + if (res == 0) { + res = getVersion() - o.getVersion(); + } + + return res; + } +}
\ No newline at end of file |
