Class DependableTrait

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.core.DependableTrait
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:29:55.020Z") @Stability(Stable) public abstract class DependableTrait extends software.amazon.jsii.JsiiObject
Trait for IDependable.

Traits are interfaces that are privately implemented by objects. Instead of showing up in the public interface of a class, they need to be queried explicitly. This is used to implement certain framework features that are not intended to be used by Construct consumers, and so should be hidden from accidental use.

Example:

 // Usage
 IConstruct[] roots = DependableTrait.get(construct).getDependencyRoots();
 // Definition
 public class TraitImplementation implements DependableTrait {
     public final IConstruct[] dependencyRoots;
     public TraitImplementation() {
         this.dependencyRoots = List.of(constructA, constructB, constructC);
     }
 }
 DependableTrait.implement(construct, new TraitImplementation());
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
    protected
    DependableTrait(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    DependableTrait(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    get(IDependable instance)
    Return the matching DependableTrait for the given class instance.
    abstract List<IConstruct>
    The set of constructs that form the root of this dependable.
    static void
    Register instance to have the given DependableTrait.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • DependableTrait

      protected DependableTrait(software.amazon.jsii.JsiiObjectRef objRef)
    • DependableTrait

      protected DependableTrait(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • DependableTrait

      @Stability(Stable) protected DependableTrait()
  • Method Details

    • get

      @Stability(Stable) @NotNull public static DependableTrait get(@NotNull IDependable instance)
      Return the matching DependableTrait for the given class instance.

      Parameters:
      instance - This parameter is required.
    • implement

      @Stability(Stable) public static void implement(@NotNull IDependable instance, @NotNull DependableTrait trait)
      Register instance to have the given DependableTrait.

      Should be called in the class constructor.

      Parameters:
      instance - This parameter is required.
      trait - This parameter is required.
    • getDependencyRoots

      @Stability(Stable) @NotNull public abstract List<IConstruct> getDependencyRoots()
      The set of constructs that form the root of this dependable.

      All resources under all returned constructs are included in the ordering dependency.