@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:35.790Z") @Stability(value=Stable) public class Aspects extends software.amazon.jsii.JsiiObject
Example:
import software.amazon.awscdk.*;
import software.constructs.Construct;
import software.constructs.IConstruct;
public class MyAspect implements IAspect {
public void visit(IConstruct node) {
if (node instanceof CfnResource && node.getCfnResourceType() == "Foo::Bar") {
this.error(node, "we do not want a Foo::Bar resource");
}
}
public void error(IConstruct node, String message) {
Annotations.of(node).addError(message);
}
}
public class MyStack extends Stack {
public MyStack(Construct scope, String id) {
super(scope, id);
Stack stack = new Stack();
CfnResource.Builder.create(stack, "Foo")
.type("Foo::Bar")
.properties(Map.of(
"Fred", "Thud"))
.build();
Aspects.of(stack).add(new MyAspect());
}
}
| Modifier | Constructor and Description |
|---|---|
protected |
Aspects(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Aspects(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(IAspect aspect)
Adds an aspect to apply this scope before synthesis.
|
List<IAspect> |
getAll()
The list of aspects which were directly applied on this scope.
|
static Aspects |
of(software.constructs.IConstruct scope)
Returns the `Aspects` object associated with a construct scope.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected Aspects(software.amazon.jsii.JsiiObjectRef objRef)
protected Aspects(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable) @NotNull public static Aspects of(@NotNull software.constructs.IConstruct scope)
scope - The scope for which these aspects will apply. This parameter is required.@Stability(value=Stable)
public void add(@NotNull
IAspect aspect)
aspect - The aspect to add. This parameter is required.Copyright © 2022. All rights reserved.