Class CqlDurationLiteralParser
java.lang.Object
org.evomaster.client.java.controller.cassandra.parser.CqlDurationLiteralParser
Parses a Cassandra duration string literal into a
CqlDurationLiteral.
Supports four formats, all optionally prefixed with - for a negative duration,
mirroring com.datastax.oss.driver.api.core.data.CqlDuration#from(String):
- Standard Cassandra:
1y2mo3w4d5h6m7s(units, including weeks, may appear in any order) - ISO 8601:
P1Y2M3DT4H5M6S - ISO 8601, weeks only:
P3W - ISO 8601, alternative format:
P0001-02-03T04:05:06
-
Method Summary
Modifier and TypeMethodDescriptionstatic CqlDurationLiteralParses a CQL duration literal into aCqlDurationLiteral.
-
Method Details
-
parse
Parses a CQL duration literal into aCqlDurationLiteral. A leading-is stripped and applied as a sign to all three components. The remainder is dispatched to the matching pattern-specific parser byparseUnsigned(java.lang.String).- Parameters:
stringDuration- the duration literal to parse; must not benull, empty, or blank- Returns:
- the parsed duration, decomposed into months, days and nanoseconds
- Throws:
IllegalArgumentException- ifstringDurationisnull, empty, or blank
-