This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Linq.J is a zero-dependency Java library that brings LINQ (Language Integrated Query) capabilities to Java, enabling SQL-like querying of in-memory collections via a fluent, chainable API with lambda expressions.
- Maven coordinates:
xyz.erupt:linq.j:0.1.1 - Requirements: JDK 8+, zero production dependencies
- Test dependencies only: JUnit 4.13.2, Gson 2.9.1
mvn clean compile # Compile
mvn clean test # Run all tests
mvn clean test -Dtest=LinqTest # Run specific test class
mvn clean test -Dtest=LinqTest#selectId # Run specific test method
mvn clean package # Build JAR
mvn clean install # Install locallyData flow: Linq (entry point) → builds a Dql schema → EruptEngine executes it → returns results.
| Package | Role |
|---|---|
grammar/ |
Six SQL-like interfaces: Select, Join, Where, GroupBy, OrderBy, Write |
schema/ |
DQL data structures: Dql (full query), Row, Column, JoinSchema, WhereSchema, OrderBySchema |
engine/ |
Engine (abstract) + EruptEngine (executes the Dql, handles joins, filtering, grouping, sorting) |
lambda/ |
Lambda parsing: SFunction (serializable function), LambdaSee (extracts field names from lambdas), Th (identity helper) |
util/ |
Columns (aggregation: sum/avg/min/max/count), RowUtil, ReflectField, CompareUtil |
consts/ |
Enums: JoinMethod, OrderByDirection, CompareSymbol, JoinExchange |
Linq.javaimplements all six grammar interfaces; methods mutate aDqlinstance, returningthisfor chaining.- Lambda expressions are serialized and parsed at runtime by
LambdaSeeusingSerializedLambdareflection to extract field names — this is why the-parameterscompiler flag is required (set inpom.xml). EruptEngineuses hash-based join optimization; columns are represented asMap<Column, Object>internally (theRowtype).- Results are materialized via
write(Class<T>),writeMap(), orwriteOne(Class<T>). - Objects must expose getter methods (Lombok
@Getterrecommended).
- UNION ALL / UNION / INTERSECT / EXCEPT
- Window functions