-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring function name generator in a constant utils file
- Loading branch information
1 parent
0249fa0
commit f7340ed
Showing
5 changed files
with
55 additions
and
45 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
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
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
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
27 changes: 27 additions & 0 deletions
27
...mithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/utils/Constants.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,27 @@ | ||
package software.amazon.polymorph.smithygo.utils; | ||
|
||
import software.amazon.smithy.model.shapes.MemberShape; | ||
|
||
public class Constants { | ||
public static final String DAFNY_RUNTIME_GO_LIBRARY_MODULE = "github.com/dafny-lang/DafnyRuntimeGo"; | ||
|
||
// TODO: Is it possible to make this function name shorter and in camelCase? | ||
/** | ||
* Generates a function name for shape visitors for AWS SDK and localservice. | ||
* | ||
* @param memberShape The visiting MemberShape | ||
* @param suffix A string to be appended at the end of the generated function name | ||
* @return A string representing the generated function name | ||
*/ | ||
public static String funcNameGenerator( | ||
final MemberShape memberShape, | ||
final String suffix | ||
) { | ||
return memberShape | ||
.getId() | ||
.toString() | ||
.replaceAll("[.$#]", "_") | ||
.concat("_") | ||
.concat(suffix); | ||
} | ||
} |