Class DefaultChecker
java.lang.Object
net.simplace.sim.check.FWChecker
net.simplace.sim.check.DefaultChecker
Custom checker that accepts everything: all checks pass and values are returned unchanged. Template for own
checkers.
- Author:
- Andreas Enders
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected NumbercheckLimits(FWSimVariable<?> aSource, Number aValue, Number aMin, Number aMax) Checks a value against its limits (nulllimits are ignored).protected booleancheckParametersInScript(Collection<String> aAllowedFields, Collection<String> aForbiddenFields, String aJexlScript) Checks the parameters of a script: they must be in the allowed fields (if given) and not in the forbidden fields.protected booleancheckSource(FWSimVariable<?> aTarget, FWSimFieldContainer aSimFieldContainer, FWSimFieldContainer aSource) Checks whether a variable may be written by the given component.protected booleancheckWriteProtectionOnContentType(FWSimVariable<?> aTarget, FWSimVariable.CONTENT_TYPE aContentType, FWSimFieldContainer aSource) Checks whether the content type of a variable allows the given component to write it.
-
Constructor Details
-
DefaultChecker
public DefaultChecker()
-
-
Method Details
-
checkLimits
protected Number checkLimits(FWSimVariable<?> aSource, Number aValue, Number aMin, Number aMax) throws SimValueOutOfRangeException Description copied from class:FWCheckerChecks a value against its limits (nulllimits are ignored).- Specified by:
checkLimitsin classFWChecker- Parameters:
aSource- the variableaValue- the valueaMin- lower limit, may benullaMax- upper limit, may benull- Returns:
- the value to use (e.g. the value itself or a limit)
- Throws:
SimValueOutOfRangeException- to reject the value
-
checkSource
protected boolean checkSource(FWSimVariable<?> aTarget, FWSimFieldContainer aSimFieldContainer, FWSimFieldContainer aSource) throws SimLinkInvalidException Description copied from class:FWCheckerChecks whether a variable may be written by the given component.- Specified by:
checkSourcein classFWChecker- Parameters:
aTarget- the variable writtenaSimFieldContainer- the owning component of the variableaSource- the writing component- Returns:
trueif writing is allowed- Throws:
SimLinkInvalidException- to reject the write access
-
checkWriteProtectionOnContentType
protected boolean checkWriteProtectionOnContentType(FWSimVariable<?> aTarget, FWSimVariable.CONTENT_TYPE aContentType, FWSimFieldContainer aSource) throws SimLinkInvalidException Description copied from class:FWCheckerChecks whether the content type of a variable allows the given component to write it.- Specified by:
checkWriteProtectionOnContentTypein classFWChecker- Parameters:
aTarget- the variable writtenaContentType- content type of the variableaSource- the writing component- Returns:
trueif writing is allowed- Throws:
SimLinkInvalidException- to reject the write access
-
checkParametersInScript
protected boolean checkParametersInScript(Collection<String> aAllowedFields, Collection<String> aForbiddenFields, String aJexlScript) Description copied from class:FWCheckerChecks the parameters of a script: they must be in the allowed fields (if given) and not in the forbidden fields.- Specified by:
checkParametersInScriptin classFWChecker- Parameters:
aAllowedFields- allowed parameter names, ornullaForbiddenFields- forbidden parameter names, ornullaJexlScript- the script- Returns:
trueif the check passed
-