Class AttributeParser
Permissive primitive parsers used by strongly-typed projections. Each
helper returns the parsed value or null, and on parse failure
records a Warning on the supplied
ProjectionContext with a stable diagnostic code.
public static class AttributeParser
- Inheritance
-
AttributeParser
- Inherited Members
Remarks
Empty or null input is treated as an absent value and produces no
diagnostic — only a non-empty value that fails to parse is reported.
Numeric parsing uses InvariantCulture. Date/time parsing follows S-100 Part 5 §10 (Simple Types) — ISO 8601 round-trip representation, normalised to UTC.
Methods
TryParseBool(string?, ProjectionContext, string?, string?)
Attempts to parse a bool; accepts "1"/"0" and
the case-insensitive forms "true"/"false". Reports
"attribute.parse.bool" on failure.
public static bool? TryParseBool(string? value, ProjectionContext context, string? relatedId = null, string? attributeName = null)
Parameters
valuestringcontextProjectionContextrelatedIdstringattributeNamestring
Returns
- bool?
TryParseDateTimeOffset(string?, ProjectionContext, string?, string?)
Attempts to parse a DateTimeOffset using ISO 8601
round-trip semantics (S-100 Part 5 §10). Values without a timezone are
assumed UTC; the result is normalised to UTC. Reports
"attribute.parse.datetime" on failure.
public static DateTimeOffset? TryParseDateTimeOffset(string? value, ProjectionContext context, string? relatedId = null, string? attributeName = null)
Parameters
valuestringcontextProjectionContextrelatedIdstringattributeNamestring
Returns
TryParseDouble(string?, ProjectionContext, string?, string?)
Attempts to parse a double; reports "attribute.parse.double" on failure.
public static double? TryParseDouble(string? value, ProjectionContext context, string? relatedId = null, string? attributeName = null)
Parameters
valuestringcontextProjectionContextrelatedIdstringattributeNamestring
Returns
TryParseInt(string?, ProjectionContext, string?, string?)
Attempts to parse an int; reports "attribute.parse.int" on failure.
public static int? TryParseInt(string? value, ProjectionContext context, string? relatedId = null, string? attributeName = null)
Parameters
valuestringcontextProjectionContextrelatedIdstringattributeNamestring
Returns
- int?