-
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.
Browse files
Browse the repository at this point in the history
Allow to use custom mapper on Enum
- Loading branch information
Showing
20 changed files
with
701 additions
and
17 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
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]; | ||
} | ||
|
||
} |
Oops, something went wrong.