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.Builderbuilder()Creates a builder forImmutableProperty.static ImmutablePropertyCreates an immutable copy of aPropertyvalue.Returns an optional description of the property.booleanThis instance is equal to all instances ofImmutablePropertythat have equal attribute values.example()Returns an optional example for the property.inthashCode()Computes a hash code from attributes:name,reference,description,example,validation.name()Returns the property name.Returns the property type.toString()Prints the immutable valuePropertywith attribute values.Returns the validation required for this property.final ImmutablePropertywithDescription(String value) Copy the current immutable object by setting a present value for the optionaldescriptionattribute.final ImmutablePropertywithDescription(Optional<String> optional) Copy the current immutable object by setting an optional value for thedescriptionattribute.final ImmutablePropertywithExample(String value) Copy the current immutable object by setting a present value for the optionalexampleattribute.final ImmutablePropertywithExample(Optional<String> optional) Copy the current immutable object by setting an optional value for theexampleattribute.final ImmutablePropertyCopy the current immutable object by setting a value for thenameattribute.final ImmutablePropertywithReference(Reference value) Copy the current immutable object by setting a value for thereferenceattribute.final ImmutablePropertywithValidation(Validation value) Copy the current immutable object by setting a value for thevalidationattribute.
-
Method Details
-
name
Returns the property name. -
reference
Returns the property type. -
description
Returns an optional description of the property.- Specified by:
descriptionin 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:
validationin interfaceProperty- Returns:
- the validation required for this property
-
withName
Copy the current immutable object by setting a value for thenameattribute. 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
thisobject
-
withReference
Copy the current immutable object by setting a value for thereferenceattribute. 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
thisobject
-
withDescription
Copy the current immutable object by setting a present value for the optionaldescriptionattribute.- Parameters:
value- The value for description- Returns:
- A modified copy or
thisif not changed
-
withDescription
Copy the current immutable object by setting an optional value for thedescriptionattribute. 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
thisif not changed
-
withExample
Copy the current immutable object by setting a present value for the optionalexampleattribute.- Parameters:
value- The value for example- Returns:
- A modified copy or
thisif not changed
-
withExample
Copy the current immutable object by setting an optional value for theexampleattribute. 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
thisif not changed
-
withValidation
Copy the current immutable object by setting a value for thevalidationattribute. 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
thisobject
-
equals
This instance is equal to all instances ofImmutablePropertythat have equal attribute values. -
hashCode
public int hashCode()Computes a hash code from attributes:name,reference,description,example,validation. -
toString
Prints the immutable valuePropertywith attribute values. -
copyOf
Creates an immutable copy of aPropertyvalue. 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) // requiredname.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
-