-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests Json generated converters use enum custom mapper
Signed-off-by: Fyro <[email protected]>
- Loading branch information
Showing
5 changed files
with
216 additions
and
0 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
34 changes: 34 additions & 0 deletions
34
src/converters/java/io/vertx/test/codegen/converter/TestCustomEnum.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 io.vertx.test.codegen.converter; | ||
|
||
public enum TestCustomEnum { | ||
|
||
DEV("dev", "development"), | ||
|
||
ITEST("itest", "integration-test"); | ||
|
||
public static TestCustomEnum of(String pName) { | ||
for (TestCustomEnum item : TestCustomEnum.values()) { | ||
if (item.names[0].equalsIgnoreCase(pName) || item.names[1].equalsIgnoreCase(pName) | ||
|| pName.equalsIgnoreCase(item.name())) { | ||
return item; | ||
} | ||
} | ||
return DEV; | ||
} | ||
|
||
private String[] names = new String[2]; | ||
|
||
TestCustomEnum(String pShortName, String pLongName) { | ||
names[0] = pShortName; | ||
names[1] = pLongName; | ||
} | ||
|
||
public String getLongName() { | ||
return names[1]; | ||
} | ||
|
||
public String getShortName() { | ||
return names[0]; | ||
} | ||
|
||
} |
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
2 changes: 2 additions & 0 deletions
2
src/converters/resources/META-INF/vertx/json-mappers.properties
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
java.time.ZonedDateTime.serializer=io.vertx.test.codegen.converter.TestDataObject#serializeZonedDateTime | ||
java.time.ZonedDateTime.deserializer=io.vertx.test.codegen.converter.TestDataObject#deserializeZonedDateTime | ||
io.vertx.test.codegen.converter.TestCustomEnum.serializer=io.vertx.test.codegen.converter.TestDataObject#serializeCustomEnum | ||
io.vertx.test.codegen.converter.TestCustomEnum.deserializer=io.vertx.test.codegen.converter.TestDataObject#deserializeCustomEnum |
Oops, something went wrong.