java-modelslisted
Install: claude install-skill MuHamza30/paypal-api-plugin
# Working with models in an APIMatic Java SDK
Most request/response data are plain generated classes with a nested `Builder` (covered in
`java-calling-endpoints`). This skill covers the **non-obvious model shapes** that trip integrations up.
The patterns are generic across APIMatic Java SDKs; take the real type names from your SDK source under
`<root>/models/`.
## The Builder split: required vs optional
Every model class carries a nested `public static class Builder`. The split is mechanical:
- **Required fields are constructor arguments** on the `Builder`.
- **Optional fields are fluent setters** — and so are the required ones, so you can also override a
constructor value later.
- `build()` returns the model; `model.toBuilder()` returns a `Builder` pre-populated from an existing
instance, which is how you derive a variant without re-listing every field.
```java
{Model} m = new {Model}.Builder(requiredA, requiredB)
.optionalC(value)
.build();
{Model} variant = m.toBuilder().optionalC(other).build();
```
A model with **no** required fields has no `Builder` constructor arguments at all — start from
`new {Model}.Builder()`. A model that extends another names its clone method after itself
(`to{Model}Builder()`) instead of `toBuilder()`.
**This SDK's models are mutable**, so each field also has a plain `@JsonSetter` setter
and the model has a no-arg constructor alongside the public all-args one. A model with required fields
additionally gets a **no-arg