From f3814a84f8471684cd483347db4fb7b107c2e635 Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Thu, 3 Dec 2020 19:28:15 -0500 Subject: Rename interfaces to match Java style Rename several interfaces that were in the style IWhatever, which Java doesn't use --- .../bjc/utils/components/DescribedComponent.java | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 base/src/main/java/bjc/utils/components/DescribedComponent.java (limited to 'base/src/main/java/bjc/utils/components/DescribedComponent.java') diff --git a/base/src/main/java/bjc/utils/components/DescribedComponent.java b/base/src/main/java/bjc/utils/components/DescribedComponent.java new file mode 100644 index 0000000..dcbaf59 --- /dev/null +++ b/base/src/main/java/bjc/utils/components/DescribedComponent.java @@ -0,0 +1,64 @@ +package bjc.utils.components; + +/** + * Represents a optional component that has status information associated with + * it. + * + * @author ben + * + */ +public interface DescribedComponent extends Comparable { + /** + * 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 DescribedComponent o) { + int res = getName().compareTo(o.getName()); + + if (res == 0) { + res = getVersion() - o.getVersion(); + } + + return res; + } +} -- cgit v1.2.3