Skip to content

Commit

Permalink
Change physicalNameGenerator in (I)Resource to be a property instead …
Browse files Browse the repository at this point in the history
…of a function.
  • Loading branch information
skinny85 committed May 3, 2019
1 parent 3d88a09 commit b7c6f7c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-s3/lib/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,8 @@ export class Bucket extends BucketBase {
return this.onEvent(EventType.ObjectRemoved, dest, ...filters);
}

public physicalNameGenerator(): PhysicalNameGenerator {
return super.physicalNameGenerator().toLowerCase();
public get physicalNameGenerator(): PhysicalNameGenerator {
return super.physicalNameGenerator.toLowerCase();
}

private validateBucketName(bucketName: string) {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk/lib/physical-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class DeployTimeOrAssignedPhysicalName extends PhysicalName {
/** @internal */
public _resolveForCrossEnv(resource: IResource): void {
if (!this.name) {
this.name = resource.physicalNameGenerator().generate();
this.name = resource.physicalNameGenerator.generate();
}
}
}
4 changes: 2 additions & 2 deletions packages/@aws-cdk/cdk/lib/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface IResource extends IConstruct {
* possibly by calling `super` and changing the resulting generator,
* to fit their needs.
*/
physicalNameGenerator(): PhysicalNameGenerator;
readonly physicalNameGenerator: PhysicalNameGenerator;

/** @internal */
_resolvePhysicalNameForCrossEnv(): void;
Expand All @@ -41,7 +41,7 @@ export abstract class Resource extends Construct implements IResource {
this.physicalName = props.physicalName || PhysicalName.deployTime();
}

public physicalNameGenerator(): PhysicalNameGenerator {
public get physicalNameGenerator(): PhysicalNameGenerator {
return PhysicalNameGenerator.from(this);
}

Expand Down

0 comments on commit b7c6f7c

Please sign in to comment.