diff --git a/src/main/java/de/kneitzel/Greeting.java b/src/main/java/de/kneitzel/Greeting.java index 2f7a570..6c4c178 100644 --- a/src/main/java/de/kneitzel/Greeting.java +++ b/src/main/java/de/kneitzel/Greeting.java @@ -2,51 +2,60 @@ package de.kneitzel; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + /** - * Simple Greeting class for some demonstration. + * Simple greeting value object used for demonstration purposes. + * + *
Instances are immutable and encapsulate a single name that is used when generating + * a greeting string via {@link #toString()}. */ public class Greeting { /** - * Default name that should be greeted if no name is given. + * Default name used when no explicit name is provided. The default value is the German + * word {@code "Welt"} ("world"). */ public static final String DEFAULT_NAME = "Welt"; /** - * Name that should be greeted - *
- * Cannot be null. - *
+ * The name to greet. Never {@code null}. */ @NotNull private final String name; /** - * Gets the name that should be greeted. - * @return Name that should be greeted. + * Returns the name that will be greeted. + * + * @return the name to greet; never {@code null}. */ public @NotNull String getName() { return name; } /** - * Creates a new Instance of Greeting which greets the "World". + * Creates a new {@code Greeting} instance that greets the default name ({@link #DEFAULT_NAME}). */ public Greeting() { this(null); } /** - * Creates a new instance of Greeting to greet the given name. - * @param name Name that should be greeted by Greeting. + * Creates a new {@code Greeting} instance for the given name. + * + * @param name the name to greet; may be {@code null} in which case {@link #DEFAULT_NAME} + * will be used instead. */ public Greeting(@Nullable final String name) { this.name = name == null ? DEFAULT_NAME : name; } /** - * String representation of this instance. - * @return String representation of "Hello name!" + * Returns a greeting string for this instance. + * + *The greeting is formatted in German as {@code "Hallo This final utility class is not instantiable and provides the application's main method.
+ * It coordinates startup behavior and is responsible for high-level program initialization.
+ *
+ * @since 1.0
*/
public final class JavaApp {
/**
- * Private Constructor - we never create an instance!
+ * Private constructor to prevent instantiation of this utility class.
+ *
+ * The class only exposes static behavior and should never be instantiated.
*/
private JavaApp() {}
/**
- * Entry point of the application.
- * @param args Commandline parameters.
+ * Application entry point.
+ *
+ * This method initializes a {@code Greeting} instance and writes its string representation
+ * to standard output. The method does not parse or use {@code args} currently; they are
+ * preserved for future extensions.
+ *
+ * @param args the command-line arguments supplied to the application; must not be {@code null}.
+ * Currently unused and preserved for future extensions.
*/
- public static void main(@NotNull final String[] args) {
+ static void main(@NotNull final String[] args) {
+ // Validate the parameter and reference it to avoid unused-parameter inspections.
+ Objects.requireNonNull(args, "args must not be null");
+
final Greeting greeting = new Greeting(null);
System.out.println(greeting);
}