Table of Contents

Class Tokenization

Namespace
Amazon.CDK
Assembly
Amazon.CDK.dll

Less oft-needed functions to manipulate Tokens.

public class Tokenization : DeputyBase
Inheritance
Tokenization

Methods

IsResolvable(object)

Return whether the given object is an IResolvable object.

public static bool IsResolvable(object obj)

Parameters

obj object

Returns

bool

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

object

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

IResolvable

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

IResolvable

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

IResolvable

ReverseNumber(double)

Un-encode a Tokenized value from a number.

public static IResolvable? ReverseNumber(double n)

Parameters

n double

Returns

IResolvable

ReverseString(string)

Un-encode a string potentially containing encoded tokens.

public static TokenizedStringFragments ReverseString(string s)

Parameters

s string

Returns

TokenizedStringFragments

StringifyNumber(double)

Stringify a number directly or lazily if it's a Token.

public static string StringifyNumber(double x)

Parameters

x double

Returns

string

Remarks

If it is an object (i.e., { Ref: 'SomeLogicalId' }), return it as-is.