I don’t know what types.DocumentType is, but I’m doing an integration of an sdk and I created a cordova plugin. the import from the sdk is like this:
import exemple.types.DocumentType; example.open(DocumentType.RG_FRENTE, myListener);
Can I somehow pass RG_FRENTE dynamically as it is done in javascript?
Something like:
example.open(DocumentType[my_parameter], myListener);
Advertisement
Answer
This solution is only if DocumentType is enum class like below.
enum DocumentType {
RG_FRENTE,
RG_ETNERF;
}
You can directly get by the valueOf method like below.
DocumentType docType = DocumentType.valueOf("RG_ETNERF");
Or like this, if you have it in variable.
String type = "RG_ETNERF"; DocumentType docType = DocumentType.valueOf(type);