1 19 package org.apache.cayenne.ejbql; 20 21 27 public class EJBQLParserFactory { 28 29 private static String DEFAULT_PARSER_CLASS = "org.apache.cayenne.ejbql.parser.EJBQL$EJBQLDefaultParser"; 31 32 private static Class parserClass; 33 34 private static Class getParserClass() throws ClassNotFoundException { 35 if (parserClass == null) { 36 parserClass = Class.forName(DEFAULT_PARSER_CLASS, true, Thread 39 .currentThread() 40 .getContextClassLoader()); 41 } 42 43 return parserClass; 44 } 45 46 public static EJBQLParser getParser() throws EJBQLException { 47 try { 48 return (EJBQLParser) getParserClass().newInstance(); 49 } 50 catch (Exception e) { 51 throw new EJBQLException("Error creating EJBQL parser", e); 52 } 53 } 54 } 55 | Popular Tags |