1 16 package org.springframework.webflow.core; 17 18 import org.springframework.binding.expression.ExpressionParser; 19 20 30 public final class DefaultExpressionParserFactory { 31 32 35 private static ExpressionParser INSTANCE; 36 37 private DefaultExpressionParserFactory() { 39 } 40 41 46 public static synchronized ExpressionParser getExpressionParser() { 47 if (INSTANCE == null) { 48 INSTANCE = createDefaultExpressionParser(); 49 } 50 return INSTANCE; 51 } 52 53 57 private static ExpressionParser createDefaultExpressionParser() { 58 try { 59 Class.forName("ognl.Ognl"); 60 return new WebFlowOgnlExpressionParser(); 61 } catch (ClassNotFoundException e) { 62 throw new IllegalStateException ( 63 "Unable to load the default expression parser: OGNL could not be found in the classpath. " 64 + "Please add OGNL 2.x to your classpath or set the default ExpressionParser instance to something that is in the classpath. " 65 + "Details: " + e.getMessage()); 66 } catch (NoClassDefFoundError e) { 67 throw new IllegalStateException ( 68 "Unable to construct the default expression parser: ognl.Ognl could not be instantiated. " 69 + "Please add OGNL 2.x to your classpath or set the default ExpressionParser instance to something that is in the classpath. " 70 + "Details: " + e); 71 } 72 } 73 } | Popular Tags |