Class Tokenization
Less oft-needed functions to manipulate Tokens.
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Tokenization : DeputyBase
Syntax (vb)
Public Class Tokenization Inherits DeputyBase
Synopsis
Methods
| IsResolvable(object) | Return whether the given object is an IResolvable object. |
| Resolve(object, IResolveOptions) | Resolves an object by evaluating all tokens and removing any undefined or empty objects or arrays. |
| Reverse(object, IReverseOptions?) | Reverse any value into a Resolvable, if possible. |
| ReverseCompleteString(string) | Un-encode a string which is either a complete encoded token, or doesn't contain tokens at all. |
| ReverseList(string[]) | Un-encode a Tokenized value from a list. |
| ReverseNumber(double) | Un-encode a Tokenized value from a number. |
| ReverseString(string) | Un-encode a string potentially containing encoded tokens. |
| StringifyNumber(double) | Stringify a number directly or lazily if it's a Token. |
Methods
IsResolvable(object)
Return whether the given object is an IResolvable object.
public static bool IsResolvable(object obj)
Parameters
- obj object
Returns
Remarks
This is different from Token.isUnresolved() which will also check for encoded Tokens, whereas this method will only do a type check on the given object.
Resolve(object, IResolveOptions)
Resolves an object by evaluating all tokens and removing any undefined or empty objects or arrays.
public static object Resolve(object obj, IResolveOptions options)
Parameters
- obj object
The object to resolve.
- options IResolveOptions
Prefix key path components for diagnostics.
Returns
Remarks
Values can only be primitives, arrays or tokens. Other objects (i.e. with methods) will be rejected.
Reverse(object, IReverseOptions?)
Reverse any value into a Resolvable, if possible.
public static IResolvable? Reverse(object x, IReverseOptions? options = null)
Parameters
- x object
- options IReverseOptions
Returns
Remarks
In case of a string, the string must not be a concatenation.
ReverseCompleteString(string)
Un-encode a string which is either a complete encoded token, or doesn't contain tokens at all.
public static IResolvable? ReverseCompleteString(string s)
Parameters
- s string
Returns
Remarks
It's illegal for the string to be a concatenation of an encoded token and something else.
ReverseList(string[])
Un-encode a Tokenized value from a list.
public static IResolvable? ReverseList(string[] l)
Parameters
- l string[]
Returns
ReverseNumber(double)
Un-encode a Tokenized value from a number.
public static IResolvable? ReverseNumber(double n)
Parameters
- n double
Returns
ReverseString(string)
Un-encode a string potentially containing encoded tokens.
public static TokenizedStringFragments ReverseString(string s)
Parameters
- s string