Package dk.mada.jaxrs.model
Class ImmutableProperty
java.lang.Object
dk.mada.jaxrs.model.ImmutableProperty
- All Implemented Interfaces:
Property
@Generated(from="Property",
generator="Immutables")
@Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableProperty
extends Object
implements Property
Immutable implementation of
Property
.
Use the builder to create immutable instances:
ImmutableProperty.builder()
.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ImmutableProperty.Builder
builder()
Creates a builder forImmutableProperty
.static ImmutableProperty
Creates an immutable copy of aProperty
value.Returns an optional description of the property.boolean
This instance is equal to all instances ofImmutableProperty
that have equal attribute values.example()
Returns an optional example for the property.int
hashCode()
Computes a hash code from attributes:name
,reference
,description
,example
,validation
.name()
Returns the property name.Returns the property type.toString()
Prints the immutable valueProperty
with attribute values.Returns the validation required for this property.final ImmutableProperty
withDescription
(String value) Copy the current immutable object by setting a present value for the optionaldescription
attribute.final ImmutableProperty
withDescription
(Optional<String> optional) Copy the current immutable object by setting an optional value for thedescription
attribute.final ImmutableProperty
withExample
(String value) Copy the current immutable object by setting a present value for the optionalexample
attribute.final ImmutableProperty
withExample
(Optional<String> optional) Copy the current immutable object by setting an optional value for theexample
attribute.final ImmutableProperty
Copy the current immutable object by setting a value for thename
attribute.final ImmutableProperty
withReference
(Reference value) Copy the current immutable object by setting a value for thereference
attribute.final ImmutableProperty
withValidation
(Validation value) Copy the current immutable object by setting a value for thevalidation
attribute.
-
Method Details
-
name
Returns the property name. -
reference
Returns the property type. -
description
Returns an optional description of the property.- Specified by:
description
in interfaceProperty
- Returns:
- an optional description of the property
-
example
Returns an optional example for the property. -
validation
Returns the validation required for this property.- Specified by:
validation
in interfaceProperty
- Returns:
- the validation required for this property
-
withName
Copy the current immutable object by setting a value for thename
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for name- Returns:
- A modified copy or the
this
object
-
withReference
Copy the current immutable object by setting a value for thereference
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for reference- Returns:
- A modified copy or the
this
object
-
withDescription
Copy the current immutable object by setting a present value for the optionaldescription
attribute.- Parameters:
value
- The value for description- Returns:
- A modified copy or
this
if not changed
-
withDescription
Copy the current immutable object by setting an optional value for thedescription
attribute. An equality check is used on inner value to prevent copying of the same value by returningthis
.- Parameters:
optional
- An optional value for description- Returns:
- A modified copy or
this
if not changed
-
withExample
Copy the current immutable object by setting a present value for the optionalexample
attribute.- Parameters:
value
- The value for example- Returns:
- A modified copy or
this
if not changed
-
withExample
Copy the current immutable object by setting an optional value for theexample
attribute. An equality check is used on inner value to prevent copying of the same value by returningthis
.- Parameters:
optional
- An optional value for example- Returns:
- A modified copy or
this
if not changed
-
withValidation
Copy the current immutable object by setting a value for thevalidation
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for validation- Returns:
- A modified copy or the
this
object
-
equals
This instance is equal to all instances ofImmutableProperty
that have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:name
,reference
,description
,example
,validation
. -
toString
Prints the immutable valueProperty
with attribute values. -
copyOf
Creates an immutable copy of aProperty
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable Property instance
-
builder
Creates a builder forImmutableProperty
.ImmutableProperty.builder() .name(String) // required
name
.reference(dk.mada.jaxrs.model.types.Reference) // requiredreference
.description(Optional<String>) // optionaldescription
.example(Optional<String>) // optionalexample
.validation(dk.mada.jaxrs.model.Validation) // requiredvalidation
.build();- Returns:
- A new ImmutableProperty builder
-