public Method resolveFunction(String prefix, String localName) { throw new ReferenceSyntaxException(); } };
/** * Invoke method binding expression for Shale <code>ActionState</code>. * Shale requires return type to be a <code>java.lang.String</code>. * * @param expr Method binding expression * @return String Method return value * @throws SCXMLExpressionException Re-throw potential Faces * exceptions as a SCXMLExpressionException. */ private String invokeShaleActionStateMethod(final String expr) throws SCXMLExpressionException { try { MethodBinding mb = context.getApplication(). createMethodBinding(expr, SIGNATURE); return (String) mb.invoke(context, PARAMETERS); //Rethrow any exception as SCXMLExpressionException instance } catch (ReferenceSyntaxException rse) { throw new SCXMLExpressionException(rse.getMessage(), rse); } catch (MethodNotFoundException mnfe) { throw new SCXMLExpressionException(mnfe.getMessage(), mnfe); } catch (EvaluationException ee) { throw new SCXMLExpressionException(ee.getMessage(), ee); } }
public Object getValue(Object base, int index) throws EvaluationException, PropertyNotFoundException { if (base instanceof FlowExecution) { throw new ReferenceSyntaxException("Cannot apply an index value to a flow execution"); } else { return resolverDelegate.getValue(base, index); } }
public void setValue(Object base, int index, Object value) throws EvaluationException, PropertyNotFoundException { if (base instanceof FlowExecution) { throw new ReferenceSyntaxException("Cannot apply an index value to a flow execution"); } else { resolverDelegate.setValue(base, index, value); } }
public Object getValue(Object base, int index) throws EvaluationException, PropertyNotFoundException { if (base == null) { return null; } try { if (base.getClass().isArray()) { return Array.get(base, index); } if (base instanceof List) { return ((List) base).get(index); } if (base instanceof UIComponent) { return ((UIComponent) base).getChildren().get(index); } } catch (IndexOutOfBoundsException e) { return null; } throw new ReferenceSyntaxException("Must be array or List. Bean: " + base.getClass().getName() + ", index " + index); }
/** * <p>Construct a configured instance.</p> * * @param application Application instance for this application * @param ref Method binding expression to be parsed * @param args Signature of this method */ public MockMethodBinding(Application application, String ref, Class[] args) { this.application = application; this.args = args; if (ref.startsWith("#{") && ref.endsWith("}")) { ref = ref.substring(2, ref.length() - 1); } this.ref = ref; int period = ref.lastIndexOf("."); if (period < 0) { throw new ReferenceSyntaxException(ref); } vb = application.createValueBinding(ref.substring(0, period)); name = ref.substring(period + 1); if (name.length() < 1) { throw new ReferenceSyntaxException(ref); } }
@SuppressWarnings("deprecation") private static String stripBracketsIfNecessary(String expression) throws ReferenceSyntaxException { assert (null != expression); // look for invalid expressions if (expression.charAt(0) == '#') { if (expression.charAt(1) != '{') { throw new ReferenceSyntaxException(MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expression)); } int len = expression.length(); if (expression.charAt(len - 1) != '}') { throw new ReferenceSyntaxException(MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expression)); } expression = expression.substring(2, len - 1); } return expression; }
public Object getValue(Object base, int index) throws EvaluationException, PropertyNotFoundException { if (base == null) { return null; } try { if (base.getClass().isArray()) { return Array.get(base, index); } if (base instanceof List) { return ((List) base).get(index); } if (base instanceof UIComponent) { return ((UIComponent) base).getChildren().get(index); } } catch (IndexOutOfBoundsException e) { return null; } throw new ReferenceSyntaxException("Must be array or List. Bean: " + base.getClass().getName() + ", index " + index); }
@SuppressWarnings("deprecation") private static String stripBracketsIfNecessary(String expression) throws ReferenceSyntaxException { assert (null != expression); // look for invalid expressions if (expression.charAt(0) == '#') { if (expression.charAt(1) != '{') { throw new ReferenceSyntaxException(MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expression)); } int len = expression.length(); if (expression.charAt(len - 1) != '}') { throw new ReferenceSyntaxException(MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expression)); } expression = expression.substring(2, len - 1); } return expression; }
@SuppressWarnings("deprecation") private static String stripBracketsIfNecessary(String expression) throws ReferenceSyntaxException { assert (null != expression); // look for invalid expressions if (expression.charAt(0) == '#') { if (expression.charAt(1) != '{') { throw new ReferenceSyntaxException(MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expression)); } int len = expression.length(); if (expression.charAt(len - 1) != '}') { throw new ReferenceSyntaxException(MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expression)); } expression = expression.substring(2, len - 1); } return expression; }
@SuppressWarnings("deprecation") private static String stripBracketsIfNecessary(String expression) throws ReferenceSyntaxException { assert (null != expression); // look for invalid expressions if (expression.charAt(0) == '#') { if (expression.charAt(1) != '{') { throw new ReferenceSyntaxException(MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expression)); } int len = expression.length(); if (expression.charAt(len - 1) != '}') { throw new ReferenceSyntaxException(MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expression)); } expression = expression.substring(2, len - 1); } return expression; }
public Integer toIndex(Object base, Object index) throws ReferenceSyntaxException { Integer indexValue = null; if (base instanceof List || base.getClass().isArray()) { indexValue = CoercionsUtil.coerceToInteger(index); if (indexValue == null) { throw new ReferenceSyntaxException(); } } else if (base instanceof UIComponent) { indexValue = CoercionsUtil.coerceToInteger(index); } return indexValue; }
/** * <p>Construct a configured instance.</p> * * @param application Application instance for this application * @param ref Method binding expression to be parsed * @param args Signature of this method */ public MockMethodBinding(Application application, String ref, Class[] args) { this.application = application; this.args = args; if (ref.startsWith("#{") && ref.endsWith("}")) { ref = ref.substring(2, ref.length() - 1); } this.ref = ref; int period = ref.lastIndexOf("."); if (period < 0) { throw new ReferenceSyntaxException(ref); } vb = application.createValueBinding(ref.substring(0, period)); name = ref.substring(period + 1); if (name.length() < 1) { throw new ReferenceSyntaxException(ref); } }
/** * <p>Construct a configured instance.</p> * * @param application Application instance for this application * @param ref Method binding expression to be parsed * @param args Signature of this method */ public MockMethodBinding(Application application, String ref, Class[] args) { this.application = application; this.args = args; if (ref.startsWith("#{") && ref.endsWith("}")) { ref = ref.substring(2, ref.length() - 1); } this.ref = ref; int period = ref.lastIndexOf("."); if (period < 0) { throw new ReferenceSyntaxException(ref); } vb = application.createValueBinding(ref.substring(0, period)); name = ref.substring(period + 1); if (name.length() < 1) { throw new ReferenceSyntaxException(ref); } }
/** * @param expressionString the expression string, with delimiters * intact. * @return a List of expressions from the expressionString * @throws ReferenceSyntaxException if the expression string is invalid */ @SuppressWarnings("deprecation") public static List<String> getExpressionsFromString(String expressionString) throws ReferenceSyntaxException { if (null == expressionString) { return Collections.emptyList(); } //noinspection CollectionWithoutInitialCapacity List<String> result = new ArrayList<>(); int i, j, len = expressionString.length(), cur = 0; while (cur < len && -1 != (i = expressionString.indexOf("#{", cur))) { if (-1 == (j = expressionString.indexOf('}', i + 2))) { throw new ReferenceSyntaxException( MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expressionString)); } cur = j + 1; result.add(expressionString.substring(i, cur)); } return result; }
/** * @param expressionString the expression string, with delimiters * intact. * @return a List of expressions from the expressionString * @throws ReferenceSyntaxException if the expression string is invalid */ @SuppressWarnings("deprecation") public static List<String> getExpressionsFromString(String expressionString) throws ReferenceSyntaxException { if (null == expressionString) { return Collections.emptyList(); } //noinspection CollectionWithoutInitialCapacity List<String> result = new ArrayList<String>(); int i, j, len = expressionString.length(), cur = 0; while (cur < len && -1 != (i = expressionString.indexOf("#{", cur))) { if (-1 == (j = expressionString.indexOf('}', i + 2))) { throw new ReferenceSyntaxException( MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expressionString)); } cur = j + 1; result.add(expressionString.substring(i, cur)); } return result; }
/** * @param expressionString the expression string, with delimiters * intact. * @return a List of expressions from the expressionString * @throws ReferenceSyntaxException if the expression string is invalid */ @SuppressWarnings("deprecation") public static List<String> getExpressionsFromString(String expressionString) throws ReferenceSyntaxException { if (null == expressionString) { return Collections.emptyList(); } //noinspection CollectionWithoutInitialCapacity List<String> result = new ArrayList<String>(); int i, j, len = expressionString.length(), cur = 0; while (cur < len && -1 != (i = expressionString.indexOf("#{", cur))) { if (-1 == (j = expressionString.indexOf('}', i + 2))) { throw new ReferenceSyntaxException( MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expressionString)); } cur = j + 1; result.add(expressionString.substring(i, cur)); } return result; }
/** * @param expressionString the expression string, with delimiters * intact. * @return a List of expressions from the expressionString * @throws ReferenceSyntaxException if the expression string is invalid */ @SuppressWarnings("deprecation") public static List<String> getExpressionsFromString(String expressionString) throws ReferenceSyntaxException { if (null == expressionString) { return Collections.emptyList(); } //noinspection CollectionWithoutInitialCapacity List<String> result = new ArrayList<>(); int i, j, len = expressionString.length(), cur = 0; while (cur < len && -1 != (i = expressionString.indexOf("#{", cur))) { if (-1 == (j = expressionString.indexOf('}', i + 2))) { throw new ReferenceSyntaxException( MessageUtils.getExceptionMessageString( MessageUtils.INVALID_EXPRESSION_ID, expressionString)); } cur = j + 1; result.add(expressionString.substring(i, cur)); } return result; }
throw new ReferenceSyntaxException("No expression in '" + ref + "'"); String name = (String) names.get(i); if (name.length() < 1) { throw new ReferenceSyntaxException("Invalid expression '" + ref + "'");
throw new ReferenceSyntaxException("No expression in '" + ref + "'"); if (name.length() < 1) throw new ReferenceSyntaxException("Invalid expression '" + ref + "'");