Package io.higson.runtime.model.value
Class ValueProperty
java.lang.Object
io.higson.runtime.model.value.Property
io.higson.runtime.model.value.ValueProperty
This class represents value property, which is a simple wrapper for any value of simple type.
These values should be type of any allowed types by
TypeConverter.- Author:
- przemek hertel
- Implementation Note:
- instead of providing simple types as String, there should be enum of allowed types and/or proper helper static methods.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionValueProperty(TypeDef type, ValueHolder holder) ValueProperty(String simpleType) CreatesValuePropertybased on simple type name.ValueProperty(String simpleType, ValueHolder holder) CreatesValuePropertybased on simple type name and preparedValueHolderwith value.ValueProperty(String simpleType, String text) -
Method Summary
Modifier and TypeMethodDescriptionbooleandeepcopy(boolean resetIds) Returns deep copy of this property's subtree.booleangetDate()Gets associated element type, based on property implementation.longgetId()getLong()doublegetValue()inthashCode()intintValue()booleanisValue()Is property a value type.voidprint(StringBuilder sb, int level, String prefix, String suffix) Adds tosbformatted String, specific forValueProperty, which looks like:voidSets new simple value, which must be supported byTypeConverter.final voidsetValue(ValueHolder value) Sets value holder and state of this property toEntityState#PERSISTENT.toString()Methods inherited from class io.higson.runtime.model.value.Property
add, add, asCollection, asEntity, asRef, asValue, at, booleanValue, bundle, clear, create, deepcopy, get, getBoolean, getBundle, getCanonicalPath, getCollection, getContainer, getDate, getDatetime, getDecimal, getEntity, getHolder, getInteger, getLong, getName, getNumber, getOwnerId, getOwnerPropertyName, getParent, getParentName, getPath, getRefCount, getRefTarget, getState, getString, getType, getTypeCode, intValue, isCollection, isEntity, isPersistent, isRoot, isTransient, iterator, print, remove, remove, resetIds, set, setContainer, setName, setOwnerId, setParent, setupOwnerId, size, traverseMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ValueProperty
CreatesValuePropertybased on simple type name.- Parameters:
simpleType- supported simple type
-
ValueProperty
- Parameters:
type- definition typeholder- holder with value
-
ValueProperty
CreatesValuePropertybased on simple type name and preparedValueHolderwith value.- Parameters:
simpleType- supported simple typeholder- holder with value
-
ValueProperty
- Parameters:
simpleType- supported simple typetext- value forStringHolder
-
-
Method Details
-
getValue
- Returns:
- value holder, that might have null value.
-
getObject
- Returns:
- direct value from holder or null if there is no holder
-
setValue
Sets value holder and state of this property toEntityState#PERSISTENT.- Parameters:
value- for this property
-
getSimpleType
- Returns:
- simple type name from definition
- See Also:
-
deepcopy
Returns deep copy of this property's subtree. -
print
Adds tosbformatted String, specific forValueProperty, which looks like:* code = CA (string) * premium = 100 (number) * su = 10000 (number) -
set
Sets new simple value, which must be supported byTypeConverter.- Specified by:
setin interfaceHandle- Overrides:
setin classProperty- Parameters:
value- new simple value- Throws:
HigsonRuntimeException- if value is not supported
-
getString
Description copied from class:Property -
getInteger
Description copied from class:Property- Specified by:
getIntegerin interfaceHandle- Overrides:
getIntegerin classProperty- Returns:
- value converted to Integer
- See Also:
-
getDecimal
Description copied from class:Property- Specified by:
getDecimalin interfaceHandle- Overrides:
getDecimalin classProperty- Returns:
- value converted to BigDecimal
- See Also:
-
booleanValue
public boolean booleanValue()Description copied from class:Property- Specified by:
booleanValuein interfaceHandle- Overrides:
booleanValuein classProperty- Returns:
- value converted to boolean
- See Also:
-
getBoolean
Description copied from class:Property- Specified by:
getBooleanin interfaceHandle- Overrides:
getBooleanin classProperty- Returns:
- value converted to Boolean
- See Also:
-
getDate
Description copied from class:Property -
getDatetime
Description copied from class:Property- Specified by:
getDatetimein interfaceHandle- Overrides:
getDatetimein classProperty- Returns:
- value converted to Date with time
- See Also:
-
getHolder
Description copied from class:Property- Specified by:
getHolderin interfaceHandle- Overrides:
getHolderin classProperty- Returns:
- value as
ValueHolder
-
getLong
Description copied from class:Property -
getNumber
public double getNumber()Description copied from class:Property -
intValue
public int intValue()Description copied from class:Property -
getElementType
Description copied from interface:HandleGets associated element type, based on property implementation.- Returns:
ElementType.VALUEelement type- See Also:
-
toString
-
equals
-
hashCode
public int hashCode() -
getId
public long getId() -
isValue
public boolean isValue()Description copied from class:PropertyIs property a value type.
-