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().

  • Method Details

    • name

      public String name()
      Returns the property name.
      Specified by:
      name in interface Property
      Returns:
      the property name
    • reference

      public Reference reference()
      Returns the property type.
      Specified by:
      reference in interface Property
      Returns:
      the property type
    • description

      public Optional<String> description()
      Returns an optional description of the property.
      Specified by:
      description in interface Property
      Returns:
      an optional description of the property
    • example

      public Optional<String> example()
      Returns an optional example for the property.
      Specified by:
      example in interface Property
      Returns:
      an optional example for the property
    • validation

      public Validation validation()
      Returns the validation required for this property.
      Specified by:
      validation in interface Property
      Returns:
      the validation required for this property
    • withName

      public final ImmutableProperty withName(String value)
      Copy the current immutable object by setting a value for the name attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for name
      Returns:
      A modified copy or the this object
    • withReference

      public final ImmutableProperty withReference(Reference value)
      Copy the current immutable object by setting a value for the reference attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for reference
      Returns:
      A modified copy or the this object
    • withDescription

      public final ImmutableProperty withDescription(String value)
      Copy the current immutable object by setting a present value for the optional description attribute.
      Parameters:
      value - The value for description
      Returns:
      A modified copy or this if not changed
    • withDescription

      public final ImmutableProperty withDescription(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the description attribute. An equality check is used on inner value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for description
      Returns:
      A modified copy or this if not changed
    • withExample

      public final ImmutableProperty withExample(String value)
      Copy the current immutable object by setting a present value for the optional example attribute.
      Parameters:
      value - The value for example
      Returns:
      A modified copy or this if not changed
    • withExample

      public final ImmutableProperty withExample(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the example attribute. An equality check is used on inner value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for example
      Returns:
      A modified copy or this if not changed
    • withValidation

      public final ImmutableProperty withValidation(Validation value)
      Copy the current immutable object by setting a value for the validation attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for validation
      Returns:
      A modified copy or the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableProperty that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: name, reference, description, example, validation.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value Property with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableProperty copyOf(Property instance)
      Creates an immutable copy of a Property 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

      public static ImmutableProperty.Builder builder()
      Creates a builder for ImmutableProperty.
       ImmutableProperty.builder()
          .name(String) // required name
          .reference(dk.mada.jaxrs.model.types.Reference) // required reference
          .description(Optional<String>) // optional description
          .example(Optional<String>) // optional example
          .validation(dk.mada.jaxrs.model.Validation) // required validation
          .build();
       
      Returns:
      A new ImmutableProperty builder