/** * Builds LHS pathElement and validates to specification */ protected ModifierSpec(string rawJsonKey, OpMode opMode) { string prefix = rawJsonKey.Substring(0, 1); string suffix = rawJsonKey.Length > 1 ? rawJsonKey.Substring(rawJsonKey.Length - 1) : null; if (OpMode.IsValid(prefix)) { _opMode = OpMode.From(prefix); rawJsonKey = rawJsonKey.Substring(1); } else { _opMode = opMode; } if (suffix == "?" && !rawJsonKey.EndsWith("\\?")) { _checkValue = true; rawJsonKey = rawJsonKey.Substring(0, rawJsonKey.Length - 1); } else { _checkValue = false; } _pathElement = PathElementBuilder.BuildMatchablePathElement(rawJsonKey); if (!(_pathElement is IStarPathElement) && !(_pathElement is LiteralPathElement) && !(_pathElement is ArrayPathElement)) { throw new SpecException(opMode.GetName() + " cannot have " + _pathElement.GetType().Name + " RHS"); } }
public RemovrSpec(string rawJsonKey) { var pathElement = Parse(rawJsonKey); if (!(pathElement is IMatchablePathElement mpe)) { throw new SpecException("Spec LHS key=" + rawJsonKey + " is not a valid LHS key."); } _pathElement = mpe; }
public CardinalitySpec(string rawJsonKey) { var pathElements = Parse(rawJsonKey); if (pathElements.Count != 1) { throw new SpecException("CardinalityTransform invalid LHS:" + rawJsonKey + " can not contain '.'"); } IPathElement pe = pathElements[0]; if (!(pe is IMatchablePathElement mpe)) { throw new SpecException("Spec LHS key=" + rawJsonKey + " is not a valid LHS key."); } _pathElement = mpe; }
public FiltrCompositeSpec(IMatchablePathElement pathElement) { PathElement = pathElement; }
public ShiftrSpec(string rawJsonKey) { _pathElement = PathElementBuilder.BuildMatchablePathElement(rawJsonKey); }