routier-collection / core/src / PropertyInfo
Class: PropertyInfo<T>
Defined in: core/src/schema/PropertyInfo.ts:8
Represents metadata and utilities for a property in a schema, including its type, name, parent, children, and serialization details.
Type Parameters
T
T extends object
Constructors
Constructor
new PropertyInfo<
T>(schema,name,parent?):PropertyInfo<T>
Defined in: core/src/schema/PropertyInfo.ts:72
Parameters
schema
SchemaBase<T, any>
name
string
parent?
PropertyInfo<T>
Returns
PropertyInfo<T>
Properties
name
readonlyname:string
Defined in: core/src/schema/PropertyInfo.ts:19
The name of the property.
from
readonlyfrom:string=null
Defined in: core/src/schema/PropertyInfo.ts:21
The name of the property we need to map from.
type
readonlytype:SchemaTypes
Defined in: core/src/schema/PropertyInfo.ts:23
The schema type of the property.
isNullable
readonlyisNullable:boolean
Defined in: core/src/schema/PropertyInfo.ts:26
Whether the property can be null.
isOptional
readonlyisOptional:boolean
Defined in: core/src/schema/PropertyInfo.ts:28
Whether the property is optional.
isKey
readonlyisKey:boolean
Defined in: core/src/schema/PropertyInfo.ts:30
Whether the property is a key.
isIdentity
readonlyisIdentity:boolean
Defined in: core/src/schema/PropertyInfo.ts:32
Whether the property is an identity property.
isReadonly
readonlyisReadonly:boolean
Defined in: core/src/schema/PropertyInfo.ts:34
Whether the property is readonly.
isUnmapped
readonlyisUnmapped:boolean
Defined in: core/src/schema/PropertyInfo.ts:36
Whether the property is unmapped.
isDistinct
readonlyisDistinct:boolean
Defined in: core/src/schema/PropertyInfo.ts:38
Whether the property is distinct.
indexes
readonlyindexes:string[]
Defined in: core/src/schema/PropertyInfo.ts:40
Indexes associated with the property.
injected
readonlyinjected:any=null
Defined in: core/src/schema/PropertyInfo.ts:43
Any injected value for the property.
defaultValue
readonlydefaultValue:any=null
Defined in: core/src/schema/PropertyInfo.ts:45
The default value for the property, if any.
valueSerializer
readonlyvalueSerializer:PropertySerializer<T> =null
Defined in: core/src/schema/PropertyInfo.ts:47
Serializer for the property value, if any.
valueDeserializer
readonlyvalueDeserializer:PropertyDeserializer<T> =null
Defined in: core/src/schema/PropertyInfo.ts:49
Deserializer for the property value, if any.
functionBody
readonlyfunctionBody:FunctionBody<any,T>
Defined in: core/src/schema/PropertyInfo.ts:51
Function body for computed properties, if any.
children
readonlychildren:PropertyInfo<T>[] =[]
Defined in: core/src/schema/PropertyInfo.ts:53
Child properties of this property.
schema
readonlyschema:SchemaBase<T,any>
Defined in: core/src/schema/PropertyInfo.ts:55
The schema this property belongs to.
innerSchema?
readonlyoptionalinnerSchema:SchemaBase<unknown,any>
Defined in: core/src/schema/PropertyInfo.ts:57
The inner schema if this property is an array.
literals
readonlyliterals:T[]
Defined in: core/src/schema/PropertyInfo.ts:59
Literal values allowed for this property.
parent?
readonlyoptionalparent:PropertyInfo<T>
Defined in: core/src/schema/PropertyInfo.ts:62
The parent property, if any.
Accessors
id
Get Signature
get id():
string
Defined in: core/src/schema/PropertyInfo.ts:10
Returns
string
level
Get Signature
get level():
number
Defined in: core/src/schema/PropertyInfo.ts:109
Returns the depth (level) of this property in the property tree.
The root property has a level of 0. Each child property increases the level by 1. Traverses up the parent chain, incrementing the level for each parent until the root is reached.
Returns
number
The number of parent properties above this property (0 for root).
hasNullableParents
Get Signature
get hasNullableParents():
boolean
Defined in: core/src/schema/PropertyInfo.ts:221
Returns true if any parent property is nullable or optional.
Returns
boolean
True if any parent is nullable or optional, false otherwise.
hasIdentityChildren
Get Signature
get hasIdentityChildren():
boolean
Defined in: core/src/schema/PropertyInfo.ts:244
Returns true if any child property (recursively) is an identity property.
Returns
boolean
True if any child is an identity property, false otherwise.
Methods
getPathArray()
getPathArray():
string[]
Defined in: core/src/schema/PropertyInfo.ts:178
Returns an array of property names representing the path from the root to this property.
Returns
string[]
The property path as an array of names.
getParentPathArray()
getParentPathArray():
string[]
Defined in: core/src/schema/PropertyInfo.ts:199
Returns an array of property names representing the path from the root to the parent of this property.
Returns
string[]
The property path as an array of names, excluding this property.
getValue()
getValue(
instance):any
Defined in: core/src/schema/PropertyInfo.ts:264
Gets the value of this property from the given instance, following the property path.
Parameters
instance
unknown
The object instance to retrieve the value from.
Returns
any
The value of the property, or null if not found.
setValue()
setValue(
instance,value):void
Defined in: core/src/schema/PropertyInfo.ts:285
Sets the value of this property on the given instance, creating intermediate objects as needed.
Parameters
instance
unknown
The object instance to set the value on.
value
unknown
The value to set.
Returns
void
getSelectrorPath()
getSelectrorPath(
options):string
Defined in: core/src/schema/PropertyInfo.ts:320
Returns a selector path string for this property, starting from the given parent variable name.
Parameters
options
parent
string
The root variable name.
assignmentType?
AssignmentType
Optional assignment type for path resolution.
useFromPropertyName?
boolean
Returns
string
The selector path string (e.g., ‘parent.prop1.prop2’).
getAssignmentPath()
getAssignmentPath(
options?):string
Defined in: core/src/schema/PropertyInfo.ts:335
Returns an assignment path string for this property, optionally starting from a parent variable name.
Parameters
options?
parent?
string
Optional root variable name.
useFromPropertyName?
boolean
Returns
string
The assignment path string (e.g., ‘prop1.prop2’).
deserialize()
deserialize(
value):string|number|boolean|Date|T
Defined in: core/src/schema/PropertyInfo.ts:349
Parameters
value
string | number |
Returns
string | number | boolean | Date | T