Package io.higson.runtime.model.value
Class RefProperty
java.lang.Object
io.higson.runtime.model.value.Property
io.higson.runtime.model.value.RefProperty
This class represents reference (pointer) to real
target Property. Created reference property acts as simple wrapper of target.
All methods call on reference will actually invoke methods on target. Reference and target property are of the same type - TypeDef.
What is also important, that reference property is equals to target property in the sense of equals and hashCode implementation.-
Constructor Summary
ConstructorsConstructorDescriptionRefProperty(Property target) Creates reference property, which points totargetProperty. -
Method Summary
Modifier and TypeMethodDescriptionasEntity()deepcopy(boolean resetIds) Creates new instance ofRefPropertywith same target instance.booleanfind(long id) Find child property in the target.Gets associated element type, based on property implementation.longgetId()intNumber of nodes referencing target's property.Gets property of reference's target.booleanChecks if target property has element of givenpath.inthashCode()booleanisRef()Is property a reference type.voidprint(StringBuilder sb, int level, String prefix, String suffix) Adds tosbformatted String, specific forRefProperty, which looks like:voidSets newvalueof this property.toString()Custom String format:Methods inherited from class io.higson.runtime.model.value.Property
add, add, asCollection, asRef, asValue, at, booleanValue, booleanValue, bundle, clear, create, deepcopy, get, getBoolean, getBoolean, getBundle, getCanonicalPath, getCollection, getContainer, getDate, getDate, getDatetime, getDatetime, getDecimal, getDecimal, getEntity, getHolder, getHolder, getInteger, getInteger, getLong, getLong, getName, getNumber, getNumber, getOwnerId, getOwnerPropertyName, getParent, getParentName, getPath, getState, getString, getString, getType, getTypeCode, intValue, intValue, isCollection, isEntity, isPersistent, isRoot, isTransient, isValue, iterator, print, remove, remove, resetIds, set, setContainer, setName, setOwnerId, setParent, setupOwnerId, size, traverseMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
RefProperty
Creates reference property, which points totargetProperty. New createdRefPropertywill be of the same type, as passedtarget.- Parameters:
target- property, to which created reference property points
-
-
Method Details
-
getId
public long getId() -
deepcopy
Creates new instance ofRefPropertywith same target instance. -
print
Adds tosbformatted String, specific forRefProperty, which looks like:* [REF] cover1 (Cover#1003 @25658) - [REF] cover2 (Cover#1004 @95658) -
set
Sets newvalueof this property.
Here it means thatthisreference will be removed from property tree, and new value will be used instead. -
isRef
public boolean isRef()Is property a reference type.- Returns:
true
-
getRefTarget
Gets property of reference's target.- Specified by:
getRefTargetin interfaceHandle- Overrides:
getRefTargetin classProperty- Returns:
- target property
-
getRefCount
public int getRefCount()Number of nodes referencing target's property.- Specified by:
getRefCountin interfaceHandle- Overrides:
getRefCountin classProperty- Returns:
- number of references
-
find
Find child property in the target.- Parameters:
id- child id- Returns:
- property within target
-
has
Checks if target property has element of givenpath.- Parameters:
path- of element to be checked- Returns:
trueif target has element, or false otherwise
-
asEntity
Description copied from class:Property- Specified by:
asEntityin interfaceHandle- Overrides:
asEntityin classProperty- Returns:
- target as
EntityProperty
-
getElementType
Description copied from interface:HandleGets associated element type, based on property implementation.- Returns:
ElementType.REFelement type- See Also:
-
equals
-
hashCode
public int hashCode() -
toString
Custom String format:RefProperty[cart.policies, target=TypeCode#1234 @123456789]
-