Package com.persequor.event
Class VocabularyElement
java.lang.Object
com.persequor.event.VocabularyElement
- All Implemented Interfaces:
- Model
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncopy()ensureAttribute(String field, String value) Set the value of an attribute.booleangetAttribute(String id) Obtain value of an attribute matching the provided id.Obtain all values of an attribute matching the provided id.getBigDecimal(String attributeName) Get the BigDecimal value of an attribute from a vocabulary element.getBoolean(String attributeName) Get the Boolean value of an attribute from a vocabulary element.Get the Float value of an attribute from a vocabulary element.getId()getInteger(String attributeName) Get the Integer value of an attribute from a vocabulary element.getLocalDate(String attributeName) Get the LocalDate value of an attribute from a vocabulary element.getOptionalBigDecimal(String attributeName) Get the optional BigDecimal value of an attribute from a vocabulary element.getOptionalBoolean(String attributeName) Get the optional Boolean value of an attribute from a vocabulary element.getOptionalFloat(String attributeName) Get the optional Float value of an attribute from a vocabulary element.getOptionalInteger(String attributeName) Get the optional Integer value of an attribute from a vocabulary element.getOptionalLocalDate(String attributeName) Get the optional LocalDate value of an attribute from a vocabulary element.Obtain value of a attribute with the provided id.inthashCode()voidsetId(ElementUri id) voidsetRecordTime(ZonedDateTime recordTime) setVocabularyUri(VocabularyUri vocabularyUri) 
- 
Constructor Details- 
VocabularyElementpublic VocabularyElement()
- 
VocabularyElement
 
- 
- 
Method Details- 
getVocabularyUri
- 
setVocabularyUri
- 
getId
- 
setId
- 
getAttributes
- 
getChildren
- 
getAttribute
- 
getAttributeValueObtain 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 thenOptional.empty()is returned and no exception is thrown. If there are multiple attributes with the same id, the first one is returned.- Parameters:
- id- of the attribute we are looking for
- Returns:
- value of the matching attribute, Optional.empty()if attribute was not found
 
- 
getAttributeValuesObtain all values 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 an empty list is returned and no exception is thrown.- Parameters:
- id- of the attribute we are looking for
- Returns:
- list of values of the matching attribute, empty list if attribute was not found
 
- 
getRequiredAttributeValueObtain 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 anIllegalArgumentExceptionis thrown- Parameters:
- id- of the attribute we are looking for
- Returns:
- not-null value associated with the matching attribute
 
- 
getRecordTime
- 
setRecordTime
- 
getIntegerGet 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.
 
- 
getOptionalIntegerGet 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.
 
- 
getLocalDateGet 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.
 
- 
getOptionalLocalDateGet 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.
 
- 
getBooleanGet 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.
 
- 
getOptionalBooleanGet 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.
 
- 
getFloatGet 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.
 
- 
getOptionalFloatGet 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.
 
- 
getBigDecimalGet 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.
 
- 
getOptionalBigDecimalGet 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.
 
- 
ensureAttributeSet the value of an attribute. If the attribute does not exist, it will be created.- Parameters:
- field- the name of the attribute
- value- the value to set
- Returns:
- this element
 
- 
hashCodepublic int hashCode()
- 
equals
- 
copy
 
-