- public static int interpretAsInteger(Object aValue) throws GeneratorExc {
- if (aValue instanceof Integer)
- return ((Integer) aValue).intValue();
-
- if (aValue instanceof String)
- try {
- return Integer.parseInt((String) aValue);
- }
- catch (Throwable t) {
- throw new GeneratorExc("Integer expected, "+aValue+" found");
- }
-
- throw new GeneratorExc("Integer expected, "+aValue+" found");
- }
-
- public static String interpretAsString(Object aValue) throws GeneratorExc {
- if (aValue instanceof String)
- return (String) aValue;
-
- if (aValue instanceof Integer)
- return ((Integer) aValue).toString();
-
- throw new GeneratorExc("String expected, "+aValue+" found");
- }
-