# Reference

An intrinsic Token that represents a reference to a construct.

References are recorded.

Extends: [Intrinsic](/cdk/api/v2/docs/aws-cdk-lib.Intrinsic.html) › Reference
Implements: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html)

- Source: [`core/lib/reference.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/core/lib/reference.ts#L12)
- Type last changed: v2.55.0 · 14 Dec 2022

## Initializer

TypeScript:

```ts
new Reference(value: any, target: IConstruct, displayName?: string, typeHint?: ResolutionTypeHint)
```

Python:

```python
Reference(value: Any, target: IConstruct, display_name: typing.Optional[str] = None, type_hint: typing.Optional[ResolutionTypeHint] = None)
```

Java:

```java
new Reference(Object value, IConstruct target, String displayName, ResolutionTypeHint typeHint)
```

C# / .NET:

```csharp
new Reference(object value, IConstruct target, string? displayName = null, ResolutionTypeHint? typeHint = null)
```

Golang:

```go
NewReference(Value interface{}, Target IConstruct, DisplayName *string, TypeHint ResolutionTypeHint)
```

## Properties

- `creationStack`: string[] — The captured stack trace which represents the location in which this token was created.

- `displayName`: string

- `target`: [IConstruct](/cdk/api/v2/docs/constructs.IConstruct.html)

- `typeHint`: [ResolutionTypeHint](/cdk/api/v2/docs/aws-cdk-lib.ResolutionTypeHint.html) — Type that the Intrinsic is expected to evaluate to.

## Methods

- `isReference(x: any): boolean` (static) — Check whether this is actually a Reference.

- `resolve(_context: IResolveContext): any` — Produce the Token's value at resolution time.

- `toJSON(): any` — Turn this Token into JSON.

  Called automatically when JSON.stringify() is called on a Token.

- `toString(): string` — Convert an instance of this Token to a string.

  This method will be called implicitly by language runtimes if the object
  is embedded into a string. We treat it the same as an explicit
  stringification.

- `toStringList(): string[]` — Convert an instance of this Token to a string list.

  This method will be called implicitly by language runtimes if the object
  is embedded into a list. We treat it the same as an explicit
  stringification.
