I have a method that accepts only a String.
public void setVerticalAlignment(String align) {
...
gd.verticalAlignment = align; // accepts only int.
...
}
But gd.verticalAlignment only accepts an int.
Usually this is set by something like gd.verticalAlignment = SWT.TOP where SWT.TOP is a static int.
is it possible to call this method with something like setVerticalAlignment("SWT.TOP")?
If you use Java 7 you can always use
switchon Strings:Being honest I would avoid using strings like
"STW.TOP". If I really had to store alignment state in the other way than justintI would use enums which might be used inswitchin older versions of Java.