Class RulesFunctions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanawsIsVirtualHostableS3Bucket(String hostLabel, boolean allowDots) static RuleArnawsParseArn(String value) static RulePartitionawsPartition(String regionName) Resolves the partition a region belongs to.static Stringstatic <T> Tcoalesce(T... args) static booleanisValidHostLabel(String hostLabel, boolean allowDots) static booleanisValidHostLabelMulti(String hostLabel) Validates a multi-label DNS name (dots allowed), theallowDots == truecase ofisValidHostLabel(java.lang.String, boolean).static booleanisValidHostLabelSingle(String hostLabel) Validates a single DNS label (no dots allowed), theallowDots == falsecase ofisValidHostLabel(java.lang.String, boolean).static Stringstatic <T> TlistAccess(List<T> values, int index) static RuleUrlSplitsvaluearounddelimiterinto at mostlimitparts, or into as many parts as there are whenlimitis 0.static booleanstringEquals(String left, String right) static Stringstatic booleansubstringEquals(String value, int startIndex, int stopIndex, boolean reverse, String literal) Equivalent tostringEquals(coalesce(substring(value, startIndex, stopIndex, reverse), ""), literal)without allocating the intermediate substring.static String
-
Constructor Details
-
RulesFunctions
public RulesFunctions()
-
-
Method Details
-
coalesce
-
coalesce
-
split
Splitsvaluearounddelimiterinto at mostlimitparts, or into as many parts as there are whenlimitis 0.None of the three arguments is optional. The rules language types
valueas a plain string, which its type checker only permits once the value is known to be set, and the specification requires a delimiter that is neither null nor empty and a limit that is not negative. A violation therefore means the rule set, or the code generated from it, is wrong - not that the request was unusual - so each is raised as anSdkClientExceptionnaming the offending argument. Generated providers surface that as a failed resolution rather than letting it escape as an unchecked exception.The checks precede the
limit == 1shortcut deliberately. That shortcut returns before either string is dereferenced, so validating after it would letsplit(null, ",", 1)return a list holding null, which reads downstream as an unset value and quietly redirects the rule rather than failing.- Throws:
SdkClientException- ifvalueis null, ifdelimiteris null or empty, or iflimitis negative.
-
ite
-
substring
-
substringEquals
public static boolean substringEquals(String value, int startIndex, int stopIndex, boolean reverse, String literal) Equivalent tostringEquals(coalesce(substring(value, startIndex, stopIndex, reverse), ""), literal)without allocating the intermediate substring. Called by optimized codegen.This mirrors
substring(java.lang.String, int, int, boolean)exactly, including its rejection of any input containing a character outside the 7-bit ASCII range. The positional comparison is done first because it fails for almost every input; the O(n) ASCII scan is only reached once the characters already match, which is precisely wheresubstring(java.lang.String, int, int, boolean)would have paid the same cost.Only equivalent for a non-empty
literal. WhenstartIndex == stopIndexthe spec'ssubstringreturns null and the coalesce makes the comparison against""true even for a null input; codegen does not rewrite that case into this method. -
uriEncode
-
parseURL
-
isValidHostLabel
-
isValidHostLabelSingle
Validates a single DNS label (no dots allowed), theallowDots == falsecase ofisValidHostLabel(java.lang.String, boolean). Called directly by optimized codegen whenallowDotsis a compile-time constant, which skips the dispatch. -
isValidHostLabelMulti
Validates a multi-label DNS name (dots allowed), theallowDots == truecase ofisValidHostLabel(java.lang.String, boolean). Called directly by optimized codegen whenallowDotsis a compile-time constant, which skips the dispatch. -
awsPartition
Resolves the partition a region belongs to.RulePartitionis immutable and is a pure function of the matchedPartition, of which there are only a handful, loaded once. The instances are therefore built up front inloadPartitionData()and shared, so this method allocates nothing on any path that resolves, and holds no per-call state.- Throws:
SdkClientException- if the region matches no partition and the loaded metadata declares no 'aws' partition to fall back to.
-
awsParseArn
-
stringEquals
-
listAccess
-
awsIsVirtualHostableS3Bucket
-