Custom Enum Type Converter ignored
See original GitHub issueWe have a customized enum like
public enum Style {
VALUE1(0),
VALUE2(1);
private final short code;
Style(int i) {
code = (short) i;
}
public short getCode() {
return code;
}
public static Style valueOf(short code) {
for(Style s : values()) {
if (code == s.getCode()) {
return s;
}
}
return null;
}
}
and correpsonding value converter
@com.raizlabs.android.dbflow.annotation.TypeConverter public class StyleConverter
extends TypeConverter<Short, Style> {
@Override public Short getDBValue(Pass.Style style) {
return style.getCode();
}
@Override public Pass.Style getModelValue(Short code) {
return Pass.Style.valueOf(code);
}
}
however, the converter is not used in the generated code. The code uses the builtin support for enum by using the enum’s name as representation in the database
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
c# - Newtonsoft.Json Ignores TypeConverters and/or ...
Now we create our custom TypeSafeEnumJsonConverter class that implements the JsonConverter object, and will call our conversion helper ...
Read more >InputRenderer ignores any defined enum custom converter
So if i look at this correctly, then for each Enum type any defined converter is ignored and the name of the enum...
Read more >How to write custom converters for JSON serialization - .NET
Learn how to create custom converters for the JSON serialization classes that are provided in the System.Text.Json namespace.
Read more >JPA 2.1 Attribute Converter - The better way to persist enums
Persisting enums with JPA 2.0 is possible, but there is no nice way to do it. Using the @Enumerated annotation, you can use...
Read more >Enum TypeConverter and description in UI for Silverlight
Now my problem is that the telerik RadGridView seems to ignore the TypeConverter and just calls Enum.ToString(). Is there any way to force...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
try adding the
@TypeConverter
annotation to your type converter implementation and just remove the typeConverter label from the column declaration site?@trevjonez Thank you so much, works. 👍