How tiagobohnenberger/fntry works
Project Type and Purpose
• FnTry is an open-source Java library (no UI or server).
• Its purpose is to provide functional exception handling, wrapping operations that may throw exceptions into composable pipelines.
File Structure
• Top-level:
• pom.xml, CI workflow under .github/workflows/maven.yml – indicates a standalone Maven module published to Maven Central.
• src/main/java/io/github/tiagobohnenberger/fntry/ – contains the core API and implementation classes: Try, Step, FallbackStrategy, Result, and functional interfaces like ThrowingFunction.
• src/test/java/.../fntry/ – unit tests for API behavior (TryTest.java) and utility classes.
README for Insights
• Describes key abstractions:
• Try.of(...) and Try.just(...) are entry points.
• orElse(), otherwise() are terminal operations handling success/failure.
• No external services; the library runs in any Java 8+ environment.
Main Components
a. Client Application Code (external): calls the FnTry API.
b. FnTry Facade: the Try class methods (of, just) that users invoke.
c. Pipeline Core:
• Step interface and its implementation (StepImpl) chain operations.
• Result object carrying success or exception.
• FallbackStrategy for providing default values.
d. Functional Interfaces: ThrowingFunction, ThrowingConsumer, etc., as extension points for user lambdas.
e. Build & CI: Maven (pom.xml) and GitHub Actions workflow (maven.yml).
Architectural Patterns & Principles
• Fluent API / Builder pattern: Try.of(...).orElse(...).otherwise(...)
• Functional Interfaces: Leveraging Java 8 lambdas for extensibility.
• Null-safety / Exception encapsulation: wrapping checked and unchecked exceptions in a unified type (Result).
• Single-module library: no microservices; a cohesive component.
Relevant Technologies
• Java 8+
• Maven for build and dependency management
• GitHub Actions for CI/CD
• JUnit (or similar) for testing
Detail
• Both successful and exceptional flows.
• Build/deployment bits (Maven, GitHub Actions) as peripheral components to show how the library is published and tested.