Package com.persequor.event
Class VocabularyElement
java.lang.Object
com.persequor.event.VocabularyElement
- All Implemented Interfaces:
Model
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()
boolean
getAttribute
(String id) Obtain value 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.int
hashCode()
void
setId
(ElementUri id) void
setRecordTime
(ZonedDateTime recordTime) setVocabularyUri
(VocabularyUri vocabularyUri)
-
Constructor Details
-
VocabularyElement
public VocabularyElement() -
VocabularyElement
-
-
Method Details
-
getVocabularyUri
-
setVocabularyUri
-
getId
-
setId
-
getAttributes
-
getChildren
-
getAttribute
-
getAttributeValue
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 thenOptional.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
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 anIllegalArgumentException
is thrown- Parameters:
id
- of the attribute we are looking for- Returns:
- not-null value associated with the matching attribute
-
getRecordTime
-
setRecordTime
-
getInteger
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
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
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
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
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
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
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
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
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
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() -
equals
-
copy
-