# Repository Overview

Welcome! This repository contains a small Java codebase focused on demonstrating two contrasting programming approaches within the `eo.ejb.wiki` package. It includes a simple data carrier class and a reflection-based utility class that together illustrate direct, compile-time-safe programming versus dynamic, runtime-driven class discovery. Whether you're here to understand Java fundamentals, explore how reflection works in practice, or use this as a reference for your own experiments, you've come to the right place.

## Overview

This project lives in the `eo.ejb.wiki` package and provides two Java classes:

- **PlainClass** — a lightweight POJO that wraps a string name and produces a greeting. It demonstrates straightforward, compile-time-safe object-oriented programming.
- **ReflectiveClass** — a utility that leverages Java Reflection to dynamically load classes by their fully qualified name and invoke methods at runtime. It demonstrates the power (and risks) of deferred type resolution.

These classes are independent of each other and carry no external dependencies. This appears to be an educational or demo repository meant to showcase both direct and reflective programming patterns side by side.

## Technology Stack

| Category | Technology |
|----------|------------|
| Language | Java |
| API Used | `java.lang.reflect` (JDK core — `java.base`) |
| External Dependencies | None |
| Build Tools | Not detected |
| Frameworks | No well-known frameworks detected |

## Architecture

The codebase is a single flat package with two classes that have no dependencies on each other. The architecture is intentionally minimal:

```mermaid
flowchart TD
    PKG["Package eo.ejb.wiki"]
    subgraph CONTENT [ ]
        PC["PlainClass"]
        RC["ReflectiveClass"]
    end
    PKG --> PC
    PKG --> RC
```

Both classes live in the same package but operate independently:

- **PlainClass** takes a string name and returns a greeting. It has no incoming or outgoing dependencies.
- **ReflectiveClass** stores a target class name and uses `Class.forName()` and `java.lang.reflect.Method` to load and invoke methods at runtime. It also has no dependencies on the surrounding codebase — it only relies on the standard JDK reflection API.

## Module Guide

### eo.ejb.wiki

This is the only module in the repository. It contains two classes that serve as contrasting examples of how to produce a result from an object.

**PlainClass** is a simple data carrier. It accepts a name through its constructor and provides a `greet()` method that returns a greeting string. It is purely stateless in its computation — no side effects, no external calls, no validation. It is the kind of class you would write for a simple value holder in any Java application.

**ReflectiveClass** takes a fundamentally different approach. Instead of defining behavior at compile time, it accepts a fully qualified class name as a string and uses `Class.forName()` to dynamically load that class at runtime. It can also discover and invoke methods (specifically a static no-arg `execute()` method) on any class passed to it. This provides flexibility — you can target any class whose name you know — but trades away compile-time safety. Errors in class or method names only surface when the code actually runs.

A few notes worth keeping in mind:
- `ReflectiveClass` uses `Class.newInstance()`, which has been deprecated since Java 9. The modern replacement is `Class.getDeclaredConstructor().newInstance()`.
- Neither class performs null checks on constructor parameters.
- Reflection-based methods declare `throws Exception` broadly; callers should handle specific exception types for cleaner error handling.

## Getting Started

If you are seeing this codebase for the first time, here is a recommended reading order:

1. **Start with [PlainClass.java](PlainClass.java)** — it is the simplest entry point. Read it in about 30 seconds. It defines a constructor and a single `greet()` method. This will ground you in the direct-programming style.

2. **Read [ReflectiveClass.java](ReflectiveClass.java)** next. It is equally short (18 lines) but introduces Java Reflection concepts: `Class.forName()`, `Class.newInstance()`, and `java.lang.reflect.Method`. This shows the dynamic-programming alternative.

3. **Read [the wiki documentation](eo/ejb/wiki.md)** for a deep dive. The wiki covers constructors, methods, exception handling, null safety, and integration notes in detail. It also includes a class relationship diagram and guidance for future development.

4. **Explore the wiki module** ([`.codewiki/eo/ejb/wiki.md`](.codewiki/eo/ejb/wiki.md)) if you want the full picture, including the reflection deprecation notice and security considerations around dynamically loading classes.

That is all there is to this repository. It is intentionally small — designed to be fully understood in a single sitting.
