# Getting Started

Welcome to the project. This guide will help you get oriented quickly.

## What This Project Does

This project demonstrates lightweight Java patterns using the `eo.ejb.wiki` module. It contains two core classes — one a simple data-and-behaviour class, the other a utility for dynamic class loading and method invocation via Java reflection.

## Recommended Reading Order

1. **[PlainClass](code://PlainClass.java)** — Start here. It is the simplest entry point and shows the basic class structure used throughout the project.
2. **[ReflectiveClass](code://ReflectiveClass.java)** — Read next. It introduces reflection-based patterns for dynamic loading and invocation.

## Key Entry Points

### PlainClass

A straightforward class that stores a name and returns a greeting. Use this as a reference for the coding style and structure expected across the codebase.

- **File**: `PlainClass.java`
- **Package**: `eo.ejb.wiki`
- **Key method**: `greet()` — returns `"Hello, <name>"`

### ReflectiveClass

A utility that uses Java reflection to dynamically load classes and invoke methods. This is the more advanced of the two and introduces reflection patterns.

- **File**: `ReflectiveClass.java`
- **Package**: `eo.ejb.wiki`
- **Key methods**:
  - `loadByReflection()` — dynamically instantiates a class by its fully-qualified name
  - `invokeMethod(Class<?>)` — invokes a static `execute()` method on a given class

## Project Structure

The project is minimal, with a single module:

```
├── eo.ejb.wiki (wiki)
│   ├── PlainClass.java
│   └── ReflectiveClass.java
```

There are no sub-modules. Everything lives under the `eo.ejb.wiki` package.

## Key Relationships

The two classes are peers within the same package — neither imports the other. `ReflectiveClass` is designed to work with any class loaded at runtime, including (in principle) `PlainClass` itself.

```mermaid
flowchart LR
    Wiki["Module: eo.ejb.wiki"]
    Plain["PlainClass
Simple greeting class"]
    Reflective["ReflectiveClass
Reflection-based loading"]
    Wiki --> Plain
    Wiki --> Reflective
```

## Configuration

This project has no external configuration files. It is self-contained Java code with no frameworks, dependency injection, or build configuration beyond standard packaging.

- **Package**: `eo.ejb.wiki` — all source lives here.
- **No config files**: Neither class reads from properties, YAML, or environment variables.

## Common Patterns

### Plain Class Pattern

`PlainClass` follows a simple constructor + getter pattern:

```java
public class PlainClass {
    private String name;

    public PlainClass(String name) {
        this.name = name;
    }

    public String greet() {
        return "Hello, " + name;
    }
}
```

- Single responsibility: hold data and return a derived string.
- Constructor injection via `final`-style field assignment.
- Public methods are simple, side-effect-free accessors.

### Reflection Pattern

`ReflectiveClass` demonstrates two reflection idioms:

1. **Dynamic instantiation** — `Class.forName(targetClass).newInstance()` loads and constructs an object given a class name string.
2. **Method invocation** — `cls.getMethod("execute").invoke(null)` locates and calls a static method by name.

Key convention: any class used with `ReflectiveClass` should expose:
- A no-arg constructor (for `loadByReflection()`)
- A static `execute()` method (for `invokeMethod()`)

### Code Style

- Standard Java naming conventions (camelCase, PascalCase).
- Public constructors, no package-private members.
- `throws Exception` on reflection methods — callers are expected to handle checked exceptions.
- No third-party dependencies or annotations.
