Class HelloTerminal

java.lang.Object
com.guinetik.examples.HelloTerminal

public class HelloTerminal extends Object
A comprehensive example class demonstrating Terminal Javadocs JXR styling with Prism.js syntax highlighting.

This class showcases various Java language features including:

  • Generics and type parameters
  • Lambda expressions and method references
  • Stream API operations
  • Optional handling
  • Exception handling patterns
  • Inner classes and enums
  • Annotations

Usage Example


 HelloTerminal terminal = new HelloTerminal("World");
 terminal.displayGreeting();
 terminal.runAsyncTask("Process data");
 
Since:
2024
Version:
1.0.0
Author:
guinetik
See Also:
  • Field Details

  • Constructor Details

    • HelloTerminal

      public HelloTerminal()
      Creates a new HelloTerminal with a default name.
    • HelloTerminal

      public HelloTerminal(String name)
      Creates a new HelloTerminal with the specified name.
      Parameters:
      name - the target name for greetings
      Throws:
      IllegalArgumentException - if name is null or empty
  • Method Details

    • displayGreeting

      public void displayGreeting()
      Displays a colorful greeting to the terminal.

      The greeting is formatted using ANSI escape codes for terminal color support.

    • addHandler

      public HelloTerminal addHandler(Function<String,String> handler)
      Registers a message handler function.
      Parameters:
      handler - the handler function to register
      Returns:
      this instance for method chaining
    • processMessage

      public String processMessage(String message)
      Processes a message through all registered handlers.
      Parameters:
      message - the message to process
      Returns:
      the processed message after all handlers have been applied
    • runAsyncTask

      public CompletableFuture<HelloTerminal.TaskResult> runAsyncTask(String taskDescription)
      Runs an asynchronous task with the given description.
      Parameters:
      taskDescription - description of the task to run
      Returns:
      a CompletableFuture containing the task result
    • findValue

      public <T> Optional<T> findValue(String key, T defaultValue)
      Finds a value by key with optional default.
      Type Parameters:
      T - the type of value to find
      Parameters:
      key - the key to search for
      defaultValue - the default value if not found
      Returns:
      an Optional containing the found value or default
    • generateSequence

      public List<String> generateSequence(int count)
      Generates a sequence of numbers with transformations.
      Parameters:
      count - the number of elements to generate
      Returns:
      a list of formatted number strings
    • getStatus

      public HelloTerminal.Status getStatus()
      Gets the current status.
      Returns:
      the current status
    • getLastActivity

      public LocalDateTime getLastActivity()
      Gets the last activity timestamp.
      Returns:
      the last activity time
    • main

      public static void main(String[] args)
      Main entry point for testing the HelloTerminal class.
      Parameters:
      args - command line arguments (first argument used as name)