A newbie question on thrift if anyone else is in a situation trying to generate the below java class from thriftIDL. I see it only supports 32-bit non negative integer values assigned. Is this because of lack of support for below enum types in other languages? I did not see if this kind can be done in thrift IDL.
public enum ExceptionTypes {
ERROR_THIS("APP_EXP_001","Some message"), ERROR_THAT(...etc
private String errorCode;
private String defaultMessage;
private ExceptionTypes(String errorCode, String defaultMessage) {
this.errorCode = errorCode;
this.defaultMessage = defaultMessage;
}
public String getErrorCode() {
return this.errorCode;
}
public String getDefaultMessage() {
return this.defaultMessage;
}
}
There is no way to add description of behavior to the Thirft enums, mainly because Thirft was intended to be small and applicable to many languages.
However, you could write yourself a constructor that creates one java enum like above when given thirft one. This will add one layer of processing in your code after you have received data from the thrift layer, but in real use cases, data structures used on the wire are rarely exactly the same as ones used inside the app anyway.
Thirft (and any rpc, CORBA or similar layer) serves to simplify network code and add robustness, not to hide its existence so that one could forget about it.