/** * get the right enum value for this file extension, or null * * @param extension * @return */ public static FileType getTypeFromExtension(String extension) { if (extension != null) { if (extension.equalsIgnoreCase(TML.getExtension())) { return TML; } if (extension.equalsIgnoreCase(JAVA.getExtension())) { return JAVA; } if (extension.equalsIgnoreCase(CLASS.getExtension())) { return CLASS; } if (extension.equalsIgnoreCase(PROPERTY.getExtension())) { return PROPERTY; } } return null; }
public static ScriptLanguage parse(String value) { if (BEANSHELL.getValue().equals(value)) { return BEANSHELL; } else if (DRL.getValue().equals(value)) { return DRL; } else if (GROOVY.getValue().equals(value)) { return GROOVY; } else if (JAVA.getValue().equals(value)) { return JAVA; } else if (JAVASCRIPT.getValue().equals(value)) { return JAVASCRIPT; } else if (PYTHON.getValue().equals(value)) { return PYTHON; } else if (RUBY.getValue().equals(value)) { return RUBY; } throw new IllegalArgumentException("Invalid value " + value); }