Creates this JSON_OP by setting the protected property JSON_OP.necessaryProperties and checkElements used by JSON_OP.check.
See JSON_OP.check.
See JSON_OP.check.
See JSON_OP.check.
Stores the settings concerning infringements
See JSON_OP.check.
Stores settings concerning warnings.
Static
InfringementAn Error to be thrown whenever an infringement is detected.
Static
paramStores all request for parameter values registered by decPrecondition.
Invokes the JSON_OP.checkAlgorithm passing the value toCheck, JSON_OP.necessaryProperties and JSON_OP.checkElements.
Reports a field-infringement via reportInfringement also generating a proper string-wrapper for the given message & name.
A string describing the infringement and it's provenience.
The dotted-path string that leads to the value not fulfilling the contract starting from the tagged one.
The property key.
The value not fulfilling a contract.
Protected
reportReports an infringement according to the infringementSettings also generating a proper string-wrapper for the given "message" & violator.
The string describing the infringement and it's provenience.
The string describing or naming the violator.
Reports a parameter-infringement via reportInfringement also generating a proper string-wrapper for the given "message","method", parameter-"index" & value.
The string describing the infringement and it's provenience.
The string describing or naming the violator.
The index of the parameter within the argument listing.
The parameter's value.
Reports a returnvalue-infringement according via reportInfringement also generating a proper string-wrapper for the given "message","method" & value.
The string describing the infringement and it's provenience.
The string describing or naming the violator.
The parameter's value.
Protected
reportReports a warning.
The message containing the warning.
Static
checkInvokes the JSON_OP.checkAlgorithm passing the value toCheck, JSON_OP.necessaryProperties and JSON_OP.checkElements.
See JSON_OP.checkAlgorithm }.
See JSON_OP.checkAlgorithm }.
See JSON_OP.checkAlgorithm }.
Static
checkChecks if the object toCheck has the necessaryProperties of necessary type.
The object to check for the necessary properties.
The **{ name : string, type : string }**s defining the properties and type the object to check needs to have.
Indicates if toCheck is an iterable object of which all elements have to be checked. Elements will only be checked if toCheck is iterable, otherwise toCheck itself will be checked.
TRUE if the value toCheck or it's elements, if checkElements is TRUE, has all necessaryProperties, otherwise a string to report the infringement.
Static
decA property-decorator factory serving as a Design By Contract Invariant. Since the value must be initialized or set according to the specified contracts the value will only be checked when assigning it.
The DBC-Contracts the value shall uphold.
A DBC.Infringement whenever the property is tried to be set to a value that does not comply to the specified contracts, by the returned method.
Static
decA method decorator factory checking the result of a method whenever it is invoked thus also usable on getters.
The (toCheck: any, object, string) => boolean | string to use for checking.
See DBC.resolveDBCPath.
The dotted path referring to the actual value to check, starting form the specified one.
The ( target : object, propertyKey : string, descriptor : PropertyDescriptor ) : PropertyDescriptor invoked by Typescript.
Protected
Static
decA parameter-decorator factory that requests the tagged parameter's value passing it to the provided "check"-method when the value becomes available.
The "( unknown ) => void" to be invoked along with the tagged parameter's value as soon as it becomes available.
See DBC.resolveDBCPath.
The dotted path referring to the actual value to check, starting form the specified one.
The (target: object, methodName: string | symbol, parameterIndex: number ) => void invoked by Typescript-
Static
INVARIANTA field-decorator factory using the JSON_OP.checkAlgorithm to determine whether this DBC is fulfilled by the tagged field.
See DBC.decInvariant.
See DBC.decInvariant.
See DBC.decPostcondition.
Static
ParamvalueA method-decorator factory checking the paramValueRequests for value-requests of the method's parameter thus also usable on setters. When found it will invoke the "receptor" registered there, inter alia by requestParamValue, with the parameter's value.
The object hosting the tagged method as provided by the runtime.
The tagged method's name as provided by the runtime.
The PropertyDescriptor as provided by the runtime.
The PropertyDescriptor that was passed by the runtime.
Static
POSTA method-decorator factory using the JSON_OP.checkAlgorithm to determine whether this DBC is fulfilled by the tagged method's returnvalue.
See DBC.Postcondition.
See DBC.decPostcondition.
See DBC.decPostcondition.
Static
PREA parameter-decorator factory using the JSON_OP.checkAlgorithm to determine whether this DBC is fulfilled by the tagged parameter.
See DBC.decPrecondition.
See DBC.decPrecondition.
See DBC.decPrecondition.
Protected
Static
requestMake a request to get the value of a certain parameter of specific method in a specific object. That request gets enlisted in paramValueRequests which is used by ParamvalueProvider to invoke the given "receptor" with the parameter value stored in there. Thus a parameter decorator using this method will not receive any value of the top method is not tagged with ParamvalueProvider.
The object containing the method with the parameter which's value is requested.
The name of the method with the parameter which's value is requested.
The index of the parameter which's value is requested.
The method the requested parameter-value shall be passed to when it becomes available.
Static
resolveResolves the desired object out a given one toResolveFrom using the specified path.
The object starting to resolve from.
The dotted path-string. This string uses ., [...], and () to represent accessing nested properties, array elements/object keys, and calling methods, respectively, mimicking JavaScript syntax to navigate an object's structure. Code, e.g. something like a.b( 1 as number ).c, will not be executed and thus make the retrieval fail.
The requested object, NULL or UNDEFINED.
Static
resolve
A DBC demanding that an object has specific properties of specific types.
Remarks
Maintainer: Callari, Salvatore (XDBC@WaXCode.net)