Map fieldsMap = jasperDesign.getFieldsMap();
Map variablesMap = jasperDesign.getVariablesMap();
JRParameter jrParameter = null;
JRField jrField = null;
JRVariable jrVariable = null;
StringBuffer sbuffer = new StringBuffer();
JRExpressionChunk[] chunks = expression.getChunks();
JRExpressionChunk chunk = null;
String chunkText = null;
if (chunks != null && chunks.length > 0)
{
for(int i = 0; i < chunks.length; i++)
{
chunk = chunks[i];
chunkText = chunk.getText();
if (chunkText == null)
{
chunkText = "";
}
switch (chunk.getType())
{
case JRExpressionChunk.TYPE_TEXT :
{
sbuffer.append(chunkText);
break;
}
case JRExpressionChunk.TYPE_PARAMETER :
{
jrParameter = (JRParameter)parametersMap.get(chunkText);
sbuffer.append("((");
sbuffer.append(jrParameter.getValueClassName());
sbuffer.append(")super.parameter_");
sbuffer.append(chunkText);
sbuffer.append(".getValue())");
break;
}
case JRExpressionChunk.TYPE_FIELD :
{
jrField = (JRField)fieldsMap.get(chunkText);
sbuffer.append("((");
sbuffer.append(jrField.getValueClassName());
sbuffer.append(")super.field_");
sbuffer.append(chunkText);
sbuffer.append(".get");
sbuffer.append((String)fieldPrefixMap.get(new Byte(evaluationType)));
sbuffer.append("Value())");
break;
}
case JRExpressionChunk.TYPE_VARIABLE :
{
jrVariable = (JRVariable)variablesMap.get(chunkText);
sbuffer.append("((");
sbuffer.append(jrVariable.getValueClassName());
sbuffer.append(")super.variable_");
sbuffer.append(chunkText);
sbuffer.append(".get");
sbuffer.append((String)variablePrefixMap.get(new Byte(evaluationType)));
sbuffer.append("Value())");