accessor method

A method that returns the value of a field, such as id() on a record or getId() on a JavaBean-style class.

In more detail

Records generate accessors named exactly like their components, with no get prefix, so Point has x() and y(). Ordinary classes and JPA entities traditionally use getX style names. Frameworks such as Jackson use accessors to read an object's data.

Examples

value.id()
order.getStatus()

Related terms

Taught in

References