Attribute modify( final AttributeDefinition definition, final String completeName, final String value, final AttributeValueQuotes valueQuotes) { return new Attribute( (definition == null? this.definition : definition), (completeName == null? this.completeName : completeName), this.operator, value, // This is not keepable (valueQuotes == null? this.valueQuotes : valueQuotes), this.templateName, this.line, this.col); }
public static IStandardExpression computeAttributeExpression( final ITemplateContext context, final IProcessableElementTag tag, final AttributeName attributeName, final String attributeValue) { if (!(tag instanceof AbstractProcessableElementTag)) { return parseAttributeExpression(context, attributeValue); } final AbstractProcessableElementTag processableElementTag = (AbstractProcessableElementTag)tag; final Attribute attribute = (Attribute) processableElementTag.getAttribute(attributeName); IStandardExpression expression = attribute.getCachedStandardExpression(); if (expression != null) { return expression; } expression = parseAttributeExpression(context, attributeValue); // If the expression has been correctly parsed AND it does not contain preprocessing marks (_), nor it is a FragmentExpression, cache it! if (expression != null && !(expression instanceof FragmentExpression) && attributeValue.indexOf('_') < 0) { attribute.setCachedStandardExpression(expression); } return expression; }
public final String getAttributeValue(final String prefix, final String name) { Validate.notNull(name, "Attribute name cannot be null"); if (this.attributes == null) { return null; } final Attribute attribute = this.attributes.getAttribute(this.templateMode, prefix, name); return attribute != null? attribute.getValue() : null; }
void write(final Writer writer) throws IOException { if (this.attributes == null) { if (this.innerWhiteSpaces != null) { // In this case, there will be only one white space writer.write(this.innerWhiteSpaces[0]); } return; } int i = 0; for (; i < this.attributes.length; i++) { writer.write(this.innerWhiteSpaces[i]); this.attributes[i].write(writer); } // There might be a final whitespace after the last attribute if (i < this.innerWhiteSpaces.length) { writer.write(this.innerWhiteSpaces[i]); } }
@Override public String toString() { final Writer stringWriter = new FastStringWriter(); try { write(stringWriter); } catch (final IOException e) { // Should never happen! throw new TemplateProcessingException("Error computing attribute representation", e); } return stringWriter.toString(); }
private Attribute buildAttribute(final String name, final String value, final AttributeValueQuotes quotes) { final AttributeDefinition attributeDefinition = this.attributeDefinitions.forName(this.templateMode, name); return new Attribute(attributeDefinition, name, Attribute.DEFAULT_OPERATOR, value, quotes, null, -1, -1); }
public final String getAttributeValue(final String completeName) { Validate.notNull(completeName, "Attribute name cannot be null"); if (this.attributes == null) { return null; } final Attribute attribute = this.attributes.getAttribute(this.templateMode, completeName); return attribute != null? attribute.getValue() : null; }
new Attribute( attributeDefinition, attributeName, attributeOperator, value, valueQuotes, this.templateName, this.lineOffset + nameLine, (nameLine == 1? this.colOffset : 0) + nameCol);
public final String getAttributeValue(final AttributeName attributeName) { Validate.notNull(attributeName, "Attribute name cannot be null"); if (this.attributes == null) { return null; } final Attribute attribute = this.attributes.getAttribute(attributeName); return attribute != null? attribute.getValue() : null; }
new Attribute( attributeDefinition, attributeName, attributeOperator, value, valueQuotes, this.templateName, this.lineOffset + nameLine, (nameLine == 1? this.colOffset : 0) + nameCol);
final IAttribute originalAttribute = originalAttributeArray[i]; newAttributeArray[i] = new Attribute( originalAttribute.getAttributeDefinition(), originalAttribute.getAttributeCompleteName(), originalAttribute.getOperator(), originalAttribute.getValue(), originalAttribute.getValueQuotes(),
final IAttribute originalAttribute = originalAttributeArray[i]; newAttributeArray[i] = new Attribute( originalAttribute.getAttributeDefinition(), originalAttribute.getAttributeCompleteName(), originalAttribute.getOperator(), originalAttribute.getValue(), originalAttribute.getValueQuotes(),