/** * 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 ShiftrSpec(string rawJsonKey) { _pathElement = PathElementBuilder.BuildMatchablePathElement(rawJsonKey); }