class staticbo.shared. PropertyContext
            Source: shared/
Provides the context for custom property functions.
Properties
new PropertyContext(properties[, getValue][, setValue])
Creates a new property context object. Warning: Property context objects are created in models internally. They are intended only to make publicly available the context for custom property functions.
Parameters
| Name | Type | Optional | Description | 
|---|---|---|---|
| 
                       properties  | 
                    
                       Array of bo.shared.PropertyInfo  | 
                    
                       
  | 
                    
                       An array of property definitions.  | 
                  
| 
                       getValue  | 
                    
                       Yes  | 
                    
                       A function that returns the current value of a property.  | 
                  |
| 
                       setValue  | 
                    
                       Yes  | 
                    
                       A function that changes the current value of a property.  | 
                  
- Throws
 - 
                
Argument error: The properties must be an array of PropertyInfo objects, or a single PropertyInfo object or null.
 - 
                
Argument error: The getValue argument must be a function.
 - 
                
Argument error: The setValue argument must be a function.
 
Properties
read-onlyprimaryProperty
                 bo.shared.PropertyInfo
              The primary property of the custom function.
read-onlyproperties
                 Array of bo.shared.PropertyInfo
              Array of property definitions that may used by the custom function.
Methods
getValue(propertyName) → any type
Gets the current value of a model property.
Parameter
| Name | Type | Optional | Description | 
|---|---|---|---|
| 
                         propertyName  | 
                      
                         string  | 
                      
                         
  | 
                      
                         The name of the property.  | 
                    
- Throws
 - 
                  
Argument error: The name must be a non-empty string.
 - 
                  
Argument error: The model has no property with the given name.
 - 
                  
Model error: The property cannot be read.
 - Returns
 - 
                  
any typeThe value of the model property. 
setValue(propertyName, value)
Sets the current value of a model property.
Parameters
| Name | Type | Optional | Description | 
|---|---|---|---|
| 
                         propertyName  | 
                      
                         string  | 
                      
                         
  | 
                      
                         The name of the property.  | 
                    
| 
                         value  | 
                      
                         any type  | 
                      
                         
  | 
                      
                         The new value of the property.  | 
                    
- Throws
 - 
                  
Argument error: The name must be a non-empty string.
 - 
                  
Argument error: The model has no property with the given name.
 - 
                  
Model error: The property cannot be written.
 
with(property) → bo.shared.PropertyContext
Sets the primary property of the custom function.
Parameter
| Name | Type | Optional | Description | 
|---|---|---|---|
| 
                         property  | 
                      
                         
  | 
                      
                         The primary property of the custom function.  | 
                    
- Returns
 - 
                  
bo.shared.PropertyContextThe property context object itself.