Class Token
Represents a special or lazily-evaluated value.
Inheritance
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Token : DeputyBase
Syntax (vb)
Public Class Token
Inherits DeputyBase
Remarks
Can be used to delay evaluation of a certain value in case, for example, that it requires some context or late-bound data. Can also be used to mark values that need special processing at document rendering time.
Tokens can be embedded into strings while retaining their original semantics.
Synopsis
Constructors
Token(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Token(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
AsAny(Object) | Return a resolvable representation of the given value. |
AsList(Object, IEncodingOptions) | Return a reversible list representation of this token. |
AsNumber(Object) | Return a reversible number representation of this token. |
AsString(Object, IEncodingOptions) | Return a reversible string representation of this token. |
CompareStrings(String, String) | Compare two strings that might contain Tokens with each other. |
IsUnresolved(Object) | Returns true if obj represents an unresolved value. |
Constructors
Token(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Token(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Token(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Token(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
AsAny(Object)
Return a resolvable representation of the given value.
public static IResolvable AsAny(object value)
Parameters
- value System.Object
Returns
AsList(Object, IEncodingOptions)
Return a reversible list representation of this token.
public static string[] AsList(object value, IEncodingOptions options = null)
Parameters
- value System.Object
- options IEncodingOptions
Returns
System.String[]
AsNumber(Object)
Return a reversible number representation of this token.
public static double AsNumber(object value)
Parameters
- value System.Object
Returns
System.Double
AsString(Object, IEncodingOptions)
Return a reversible string representation of this token.
public static string AsString(object value, IEncodingOptions options = null)
Parameters
- value System.Object
- options IEncodingOptions
Returns
System.String
Remarks
If the Token is initialized with a literal, the stringified value of the literal is returned. Otherwise, a special quoted string representation of the Token is returned that can be embedded into other strings.
Strings with quoted Tokens in them can be restored back into
complex values with the Tokens restored by calling resolve()
on the string.
CompareStrings(String, String)
Compare two strings that might contain Tokens with each other.
public static TokenComparison CompareStrings(string possibleToken1, string possibleToken2)
Parameters
- possibleToken1 System.String
- possibleToken2 System.String
Returns
IsUnresolved(Object)
Returns true if obj represents an unresolved value.
public static bool IsUnresolved(object obj)
Parameters
- obj System.Object
The object to test.
Returns
System.Boolean
Remarks
One of these must be true:
This does NOT recurse into lists or objects to see if they contain resolvables.