Skip to content

Commit

Permalink
Allow users to get ETemplateType based on String input (#22)
Browse files Browse the repository at this point in the history
## Description

Adds method that returns ETemplateType based on String value.

## Type of Change

* New feature (non-breaking change which adds functionality)

## Checklist

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] My changes generate no new warnings

Signed-off-by: Jakub Stejskal <[email protected]>
  • Loading branch information
Frawless authored Jul 16, 2024
1 parent 5c9f2d0 commit ce913c1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/io/skodjob/datagenerator/enums/ETemplateType.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,19 @@ public enum ETemplateType {
public String getTemplateName() {
return templateName;
}

/**
* Gets the name of the template based on String name
*
* @param value string representation of template name
* @return specific template
*/
public static ETemplateType getFromString(String value) {
for (ETemplateType type : values()) {
if (type.toString().equalsIgnoreCase(value)) {
return type;
}
}
return null;
}
}

0 comments on commit ce913c1

Please sign in to comment.