protected Expression createConstantExpression( String tagName, String attributeName, String attributeValue) { return new ConstantExpression(attributeValue); }
/** * Adds the given Expression object to the current Script. */ protected void addExpressionScript(ScriptBlock script, Expression expression) { if ( expression instanceof ConstantExpression ) { ConstantExpression constantExpression = (ConstantExpression) expression; Object value = constantExpression.getValue(); if ( value != null ) { script.addScript(new TextScript( value.toString() )); } } else if ( expression instanceof CompositeExpression ) { CompositeTextScriptBlock newBlock = new CompositeTextScriptBlock(); script.addScript(newBlock); CompositeExpression compositeExpression = (CompositeExpression) expression; Iterator iter = compositeExpression.getExpressions().iterator(); while (iter.hasNext()) { addExpressionScript( newBlock, (Expression) iter.next() ); } } else { script.addScript(new ExpressionScript(expression)); } }
/** * Adds the given Expression object to the current Script. */ protected void addExpressionScript(ScriptBlock script, Expression expression) { if ( expression instanceof ConstantExpression ) { ConstantExpression constantExpression = (ConstantExpression) expression; Object value = constantExpression.getValue(); if ( value != null ) { script.addScript(new TextScript( value.toString() )); } } else if ( expression instanceof CompositeExpression ) { CompositeTextScriptBlock newBlock = new CompositeTextScriptBlock(); script.addScript(newBlock); CompositeExpression compositeExpression = (CompositeExpression) expression; Iterator iter = compositeExpression.getExpressions().iterator(); while (iter.hasNext()) { addExpressionScript( newBlock, (Expression) iter.next() ); } } else { if (escapeByDefault) expression = createEscapingExpression(expression); script.addScript(new ExpressionScript(expression)); } }
protected Expression createConstantExpression( String tagName, String attributeName, String attributeValue) { return new ConstantExpression(attributeValue); }
/** * Adds the given Expression object to the current Script. */ protected void addExpressionScript(ScriptBlock script, Expression expression) { if ( expression instanceof ConstantExpression ) { ConstantExpression constantExpression = (ConstantExpression) expression; Object value = constantExpression.getValue(); if ( value != null ) { script.addScript(new TextScript( value.toString() )); } } else if ( expression instanceof CompositeExpression ) { CompositeTextScriptBlock newBlock = new CompositeTextScriptBlock(); script.addScript(newBlock); CompositeExpression compositeExpression = (CompositeExpression) expression; Iterator iter = compositeExpression.getExpressions().iterator(); while (iter.hasNext()) { addExpressionScript( newBlock, (Expression) iter.next() ); } } else { if (escapeByDefault) expression = new EscapingExpression(expression); script.addScript(new ExpressionScript(expression)); } }
protected Expression createConstantExpression( String tagName, String attributeName, String attributeValue) { return new ConstantExpression(attributeValue); }
/** * Adds the given Expression object to the current Script. */ protected void addExpressionScript(ScriptBlock script, Expression expression) { if ( expression instanceof ConstantExpression ) { ConstantExpression constantExpression = (ConstantExpression) expression; Object value = constantExpression.getValue(); if ( value != null ) { script.addScript(new TextScript( value.toString() )); } } else if ( expression instanceof CompositeExpression ) { CompositeTextScriptBlock newBlock = new CompositeTextScriptBlock(); script.addScript(newBlock); CompositeExpression compositeExpression = (CompositeExpression) expression; Iterator iter = compositeExpression.getExpressions().iterator(); while (iter.hasNext()) { addExpressionScript( newBlock, (Expression) iter.next() ); } } else { if (escapeByDefault) expression = new EscapingExpression(expression); script.addScript(new ExpressionScript(expression)); } }
protected Expression createConstantExpression( String tagName, String attributeName, String attributeValue) { return new ConstantExpression(attributeValue); }
/** * Obtains the value from the map entry in the right type. */ private Object getValue(Entry entry, Class type) { Object value = entry.getValue(); if (type== Expression.class) value = new ConstantExpression(entry.getValue()); return value; }
/** * A helper method to add a new constant text expression */ public void addTextExpression(String text) { addExpression(new ConstantExpression(text)); }
/** * A helper method to add a new constant text expression */ public void addTextExpression(String text) { addExpression(new ConstantExpression(text)); }
/** * A helper method to add a new constant text expression */ public void addTextExpression(String text) { addExpression(new ConstantExpression(text)); }
/** * A helper method to add a new constant text expression */ public void addTextExpression(String text) { addExpression(new ConstantExpression(text)); }
/** Allows taglibs to use their own expression evaluation mechanism */ public Expression createExpression( ExpressionFactory factory, TagScript tagScript, String attributeName, String attributeValue) throws JellyException { ExpressionFactory myFactory = getExpressionFactory(); if (myFactory == null) { myFactory = factory; } if (myFactory != null) { return CompositeExpression.parse(attributeValue, myFactory); } // will use a constant expression instead return new ConstantExpression(attributeValue); }
/** Allows taglibs to use their own expression evaluation mechanism */ public Expression createExpression( ExpressionFactory factory, TagScript tagScript, String attributeName, String attributeValue) throws JellyException { ExpressionFactory myFactory = getExpressionFactory(); if (myFactory == null) { myFactory = factory; } if (myFactory != null) { return CompositeExpression.parse(attributeValue, myFactory); } // will use a constant expression instead return new ConstantExpression(attributeValue); }
/** Allows taglibs to use their own expression evaluation mechanism */ public Expression createExpression( ExpressionFactory factory, TagScript tagScript, String attributeName, String attributeValue) throws JellyException { ExpressionFactory myFactory = getExpressionFactory(); if (myFactory == null) { myFactory = factory; } if (myFactory != null) { return CompositeExpression.parse(attributeValue, myFactory); } // will use a constant expression instead return new ConstantExpression(attributeValue); }
/** Allows taglibs to use their own expression evaluation mechanism */ public Expression createExpression( ExpressionFactory factory, TagScript tagScript, String attributeName, String attributeValue) throws JellyException { ExpressionFactory myFactory = getExpressionFactory(); if (myFactory == null) { myFactory = factory; } if (myFactory != null) { return CompositeExpression.parse(attributeValue, myFactory); } // will use a constant expression instead return new ConstantExpression(attributeValue); }
/** * Create a tag script if the given QName is a taglib invocation, or return null * to handle it like a literal static tag. */ private TagScript createTagScript(QName n, Map<?, ?> attributes) throws JellyException { TagLibrary lib = context.getTagLibrary(n.getNamespaceURI()); if(lib!=null) { String localName = n.getLocalPart(); TagScript tagScript = lib.createTagScript(localName, null/*this parameter appears to be unused.*/); if (tagScript==null) tagScript = lib.createTagScript(localName.replace('_','-'), null); if (tagScript!=null) { if (attributes != null) { for (Entry e : attributes.entrySet()) { Object v = e.getValue(); if (v!=null) tagScript.addAttribute(e.getKey().toString(), new ConstantExpression(v)); } } return tagScript; } } // otherwise treat it as a literal. return null; }
return new ConstantExpression(text);
return new ConstantExpression(text);