Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 2.32 KB

File metadata and controls

35 lines (24 loc) · 2.32 KB

Code Style

Read this when writing new Java code. See CLAUDE.md for the always-applied formatting rule.

Formatting (enforced)

  • Spotless + palantir-java-format (build.gradle). Run ./gradlew spotlessApply before committing; ./gradlew check (and CI) fails on unformatted code. Do not hand-tune whitespace to fight the formatter — let it decide.
  • .editorconfig: 4-space indentation for *.java, 2-space for *.gradle, LF line endings, UTF-8, final newline required.
  • Target Java 8 language level — no var, records, switch expressions, or other post-8 syntax in src/.

Generated code

Fern-generated files begin with:

/**
 * This file was auto-generated by Fern from our API Definition.
 */

Match the surrounding generated style only if you are (rarely) editing a generated file that is explicitly listed in .fernignore. Otherwise, do not touch generated files — see pitfalls.md.

Patterns used in this project

  • Builder entry points. Public clients are constructed via builders, not raw constructors:
    • AuthAPI.newBuilder(domain, clientId, clientSecret).build() (Authentication API, hand-maintained)
    • ManagementApi.builder().domain(...).token(...).build() or .clientCredentials(clientId, clientSecret) (Management API)
  • Supplier-backed lazy resource clients. ManagementApi exposes each resource client as a Supplier<XxxClient> (e.g. usersClient, rolesClient) constructed lazily from ClientOptions. Follow this shape when extending the hand-maintained core.
  • Sync + Async pairs. Most Management resource clients have a mirror AsyncXxxClient and a RawXxxClient (raw HTTP response) variant. Keep additions consistent across the trio when working in hand-maintained code.
  • Typed request/response objects. Management calls return typed response types (e.g. GetUserResponseContent) rather than generic maps.
  • HTTP abstraction. All HTTP goes through the com.auth0.net layer over OkHttp; don't instantiate OkHttp clients directly in feature code.

Naming

Standard Java conventions: UpperCamelCase types, lowerCamelCase members, UPPER_SNAKE_CASE constants. wildcard_import_limit = 9999 in .editorconfig means wildcard imports are not collapsed — but palantir-java-format governs import ordering, so just run spotlessApply.