Class VocabularyElement

java.lang.Object
com.persequor.event.VocabularyElement
All Implemented Interfaces:
Model

public class VocabularyElement extends Object implements Model
  • Constructor Details

    • VocabularyElement

      public VocabularyElement()
    • VocabularyElement

      public VocabularyElement(VocabularyUri vocabularyUri, ElementUri id)
  • Method Details

    • getVocabularyUri

      public VocabularyUri getVocabularyUri()
    • setVocabularyUri

      public VocabularyElement setVocabularyUri(VocabularyUri vocabularyUri)
    • getId

      public ElementUri getId()
    • setId

      public void setId(ElementUri id)
    • getAttributes

      public VocabularyElementAttributeList getAttributes()
    • getChildren

      public VocabularyElementChildList getChildren()
    • getAttribute

      public Optional<VocabularyElementAttribute> getAttribute(String id)
    • getAttributeValue

      public Optional<String> getAttributeValue(String id)
      Obtain value of an attribute matching the provided id. This method is null safe so if there's no matching attribute or the associated values is null then Optional.empty() is returned and no exception is thrown.
      Parameters:
      id - of the attribute we are looking for
      Returns:
      value of the matching attribute, Optional.empty() if attribute was not found
    • getRequiredAttributeValue

      public String getRequiredAttributeValue(String id)
      Obtain value of a attribute with the provided id. If there's no such an attribute or the value associated to that attribute is null then an IllegalArgumentException is thrown
      Parameters:
      id - of the attribute we are looking for
      Returns:
      not-null value associated with the matching attribute
    • getRecordTime

      public ZonedDateTime getRecordTime()
    • setRecordTime

      public void setRecordTime(ZonedDateTime recordTime)
    • getInteger

      public Integer getInteger(String attributeName)
      Get the Integer value of an attribute from a vocabulary element.
      Parameters:
      attributeName - the attribute name to get the value of.
      Returns:
      the value of the attribute as an Integer.
      Throws:
      NumberFormatException - if the value of the attribute is not a valid Integer.
      IllegalArgumentException - if the attribute is not found.
    • getOptionalInteger

      public Optional<Integer> getOptionalInteger(String attributeName)
      Get the optional Integer value of an attribute from a vocabulary element.
      Parameters:
      attributeName - the attribute name to get the value of.
      Returns:
      an optional containing the value of the attribute as an Integer, or an empty optional if the attribute does not exist.
      Throws:
      NumberFormatException - if the value of the attribute is not a valid Integer.
    • getLocalDate

      public LocalDate getLocalDate(String attributeName)
      Get the LocalDate value of an attribute from a vocabulary element.
      Parameters:
      attributeName - the attribute name to get the value of.
      Returns:
      the value of the attribute as a LocalDate.
      Throws:
      DateTimeParseException - if the value of the attribute is not a valid LocalDate.
      IllegalArgumentException - if the attribute is not found.
    • getOptionalLocalDate

      public Optional<LocalDate> getOptionalLocalDate(String attributeName)
      Get the optional LocalDate value of an attribute from a vocabulary element.
      Parameters:
      attributeName - the attribute name to get the value of.
      Returns:
      an optional containing the value of the attribute as a LocalDate, or an empty optional if the attribute does not exist.
      Throws:
      DateTimeParseException - if the value of the attribute is not a valid LocalDate.
    • getBoolean

      public Boolean getBoolean(String attributeName)
      Get the Boolean value of an attribute from a vocabulary element. Will parse the string value `true` to a true boolean, will parse any other value to `false`.
      Parameters:
      attributeName - the attribute name to get the value of.
      Returns:
      the value of the attribute as a Boolean.
      Throws:
      IllegalArgumentException - if the attribute is not found.
    • getOptionalBoolean

      public Optional<Boolean> getOptionalBoolean(String attributeName)
      Get the optional Boolean value of an attribute from a vocabulary element.
      Parameters:
      attributeName - the attribute name to get the value of.
      Returns:
      an optional containing the value of the attribute as a Boolean, or an empty optional if the attribute does not exist.
    • getFloat

      public Float getFloat(String attributeName)
      Get the Float value of an attribute from a vocabulary element.
      Parameters:
      attributeName - the attribute name to get the value of.
      Returns:
      the value of the attribute as a Float.
      Throws:
      NumberFormatException - if the value of the attribute is not a valid Float.
      IllegalArgumentException - if the attribute is not found.
    • getOptionalFloat

      public Optional<Float> getOptionalFloat(String attributeName)
      Get the optional Float value of an attribute from a vocabulary element.
      Parameters:
      attributeName - the attribute name to get the value of.
      Returns:
      an optional containing the value of the attribute as a Float, or an empty optional if the attribute does not exist.
      Throws:
      NumberFormatException - if the value of the attribute is not a valid Float.
    • getBigDecimal

      public BigDecimal getBigDecimal(String attributeName)
      Get the BigDecimal value of an attribute from a vocabulary element.
      Parameters:
      attributeName - the attribute name to get the value of.
      Returns:
      the value of the attribute as a BigDecimal.
      Throws:
      NumberFormatException - if the value of the attribute is not a valid BigDecimal.
      IllegalArgumentException - if the attribute is not found.
    • getOptionalBigDecimal

      public Optional<BigDecimal> getOptionalBigDecimal(String attributeName)
      Get the optional BigDecimal value of an attribute from a vocabulary element.
      Parameters:
      attributeName - the attribute name to get the value of.
      Returns:
      an optional containing the value of the attribute as a BigDecimal, or an empty optional if the attribute does not exist.
      Throws:
      NumberFormatException - if the value of the attribute is not a valid BigDecimal.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • copy

      public VocabularyElement copy()