-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull request #133: [ITB-1769] Extend the JSON validator to also suppo…
…rt YAML as input Merge in ITB/json-validator from development to master * commit '303fc99863e791d79cf5c4ab177cbaf2361bb999': [ITB-1769] Extend the JSON validator to also support YAML as input
- Loading branch information
Showing
6 changed files
with
165 additions
and
24 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
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
41 changes: 41 additions & 0 deletions
41
jsonvalidator-common/src/main/java/eu/europa/ec/itb/json/validation/YamlSupportEnum.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,41 @@ | ||
package eu.europa.ec.itb.json.validation; | ||
|
||
public enum YamlSupportEnum { | ||
|
||
/** No support (only JSON is supported). */ | ||
NONE("none"), | ||
/** Forced (only YAML is supported). */ | ||
FORCE("force"), | ||
/** Supported (both YAML and JSON are supported). */ | ||
SUPPORT("support"); | ||
|
||
private final String value; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param value The enum's underlying value. | ||
*/ | ||
YamlSupportEnum(String value) { | ||
this.value = value; | ||
} | ||
|
||
/** | ||
* Get the enum type that corresponds to the provided value. | ||
* | ||
* @param value The value to process. | ||
* @return The resulting enum. | ||
* @throws IllegalArgumentException If the provided value is unknown. | ||
*/ | ||
public static YamlSupportEnum fromValue(String value) { | ||
if (NONE.value.equals(value)) { | ||
return NONE; | ||
} else if (FORCE.value.equals(value)) { | ||
return FORCE; | ||
} else if (SUPPORT.value.equals(value)) { | ||
return SUPPORT; | ||
} | ||
throw new IllegalArgumentException("Unknown YAML support type ["+value+"]"); | ||
} | ||
|
||
} |