-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Steven Yuan
authored
Sep 25, 2023
1 parent
2503655
commit 0b3b4cb
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...ain/java/software/amazon/smithy/typescript/codegen/sections/SmithyContextCodeSection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package software.amazon.smithy.typescript.codegen.sections; | ||
|
||
import software.amazon.smithy.model.shapes.OperationShape; | ||
import software.amazon.smithy.model.shapes.ServiceShape; | ||
import software.amazon.smithy.utils.CodeSection; | ||
import software.amazon.smithy.utils.SmithyBuilder; | ||
import software.amazon.smithy.utils.SmithyUnstableApi; | ||
|
||
@SmithyUnstableApi | ||
public final class SmithyContextCodeSection implements CodeSection { | ||
private final ServiceShape service; | ||
private final OperationShape operation; | ||
|
||
private SmithyContextCodeSection(Builder builder) { | ||
service = SmithyBuilder.requiredState("service", builder.service); | ||
operation = SmithyBuilder.requiredState("operation", builder.operation); | ||
} | ||
|
||
public ServiceShape getService() { | ||
return service; | ||
} | ||
|
||
public OperationShape getOperation() { | ||
return operation; | ||
} | ||
|
||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
public static class Builder implements SmithyBuilder<SmithyContextCodeSection> { | ||
private ServiceShape service; | ||
private OperationShape operation; | ||
|
||
@Override | ||
public SmithyContextCodeSection build() { | ||
return new SmithyContextCodeSection(this); | ||
} | ||
|
||
public Builder service(ServiceShape service) { | ||
this.service = service; | ||
return this; | ||
} | ||
|
||
public Builder operation(OperationShape operation) { | ||
this.operation = operation; | ||
return this; | ||
} | ||
} | ||
} |