-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: component position property (#259)
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/fr/insee/lunatic/model/flat/ComponentPosition.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,34 @@ | ||
package fr.insee.lunatic.model.flat; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
|
||
/** | ||
* Enum to define where a component should be displayed in a page. | ||
*/ | ||
public enum ComponentPosition { | ||
|
||
/** Equivalent to a null value. This value is there to indicate explicitly that the position option is at default | ||
* (a null value is implicit). */ | ||
DEFAULT("default"), | ||
|
||
/** The component should be displayed on the bottom of the page. */ | ||
BOTTOM("bottom"); | ||
|
||
@JsonValue | ||
private final String value; | ||
|
||
@JsonCreator | ||
ComponentPosition(String value) { | ||
this.value = value; | ||
} | ||
|
||
public static ComponentPosition fromValue(String value) { | ||
for (ComponentPosition position : ComponentPosition.values()) { | ||
if (value.equals(position.value)) | ||
return position; | ||
} | ||
throw new IllegalArgumentException(value); | ||
} | ||
|
||
} |
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