Class AggregateVersion

  • All Implemented Interfaces:
    Serializable, Comparable<org.fuin.objects4j.vo.AbstractIntegerValueObject>, org.fuin.objects4j.vo.ValueObject, org.fuin.objects4j.vo.ValueObjectWithBaseType<Integer>

    public final class AggregateVersion
    extends org.fuin.objects4j.vo.AbstractIntegerValueObject
    Version of an aggregate.
    See Also:
    Serialized Form
    • Constructor Detail

      • AggregateVersion

        public AggregateVersion​(@NotNull @Min(0L)
                                @NotNull @Min(0L) Integer version)
        Constructor with value.
        Parameters:
        version - Version.
    • Method Detail

      • asBaseType

        public final Integer asBaseType()
      • isValid

        public static boolean isValid​(Integer value)
        Returns the information if a given integer is a valid version.
        Parameters:
        value - Value to check. A null value returns true.
        Returns:
        TRUE if it's a valid version, else FALSE.
      • isValid

        public static boolean isValid​(String value)
        Returns the information if a given string is a valid version.
        Parameters:
        value - Value to check. A null value returns true.
        Returns:
        TRUE if it's a valid version, else FALSE.
      • valueOf

        public static AggregateVersion valueOf​(Integer value)
        Parses a version identifier.
        Parameters:
        value - Value to convert. A null value returns null.
        Returns:
        Converted value.
      • valueOf

        public static AggregateVersion valueOf​(String value)
        Parses a version identifier.
        Parameters:
        value - Value to convert. A null value returns null.
        Returns:
        Converted value.
      • requireArgValid

        public static void requireArgValid​(@NotNull
                                           @NotNull String name,
                                           @Nullable
                                           Integer value)
                                    throws org.fuin.objects4j.common.ConstraintViolationException
        Verifies if the argument is valid and throws an exception if this is not the case.
        Parameters:
        name - Name of the value for a possible error message.
        value - Value to check.
        Throws:
        org.fuin.objects4j.common.ConstraintViolationException - The value was not valid.
      • requireArgValid

        public static void requireArgValid​(@NotNull
                                           @NotNull String name,
                                           @Nullable
                                           String value)
                                    throws org.fuin.objects4j.common.ConstraintViolationException
        Verifies if the argument is valid and throws an exception if this is not the case.
        Parameters:
        name - Name of the value for a possible error message.
        value - Value to check.
        Throws:
        org.fuin.objects4j.common.ConstraintViolationException - The value was not valid.