Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runtime-config: #465 Add missing trait to Column interface
- Loading branch information
Showing
3 changed files
with
37 additions
and
29 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
33 changes: 33 additions & 0 deletions
33
...ent/runtime-config/src/main/java/com/speedment/runtime/config/trait/HasEnumConstants.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
package com.speedment.runtime.config.trait; | |||
|
|||
import com.speedment.runtime.config.Document; | |||
|
|||
import java.util.Optional; | |||
|
|||
/** | |||
* A trait for {@link Document documents} that implement the | |||
* {@link #getEnumConstants()} method. | |||
* | |||
* @author Emil Forslund | |||
* @since 3.0.10 | |||
*/ | |||
public interface HasEnumConstants extends Document { | |||
|
|||
/** | |||
* The attribute for the 'enumConstants' field in the JSON Configuration | |||
* file. | |||
*/ | |||
String ENUM_CONSTANTS = "enumConstants"; | |||
|
|||
/** | |||
* Returns a comma separated string of the possible values that this column | |||
* may have. If the list of potential values are not constrained, an empty | |||
* optional is returned. | |||
* | |||
* @return list of constant values separated by commas or empty | |||
*/ | |||
default Optional<String> getEnumConstants() { | |||
return getAsString(ENUM_CONSTANTS); | |||
} | |||
|
|||
} |
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