if ("size".contains(value)) {
expression.appendPart(new ExpressionMethod("size", "int", SuggestionCompletionEngine.TYPE_NUMERIC));
} else if ("isEmpty".equals(value)) {
expression.appendPart(new ExpressionMethod("isEmpty", "boolean", SuggestionCompletionEngine.TYPE_BOOLEAN));
} else {
ExpressionCollectionIndex collectionIndex;
String factName = getCompletionEngine().getFactNameFromType(getCurrentParametricType());
if (getCurrentParametricType() != null && factName != null) {
collectionIndex = new ExpressionCollectionIndex("get", getCurrentParametricType(), factName);
} else {
collectionIndex = new ExpressionCollectionIndex("get", "java.lang.Object",
SuggestionCompletionEngine.TYPE_OBJECT);
}
if ("first".equals(value)) {
collectionIndex.putParam("index", new ExpressionFormLine(new ExpressionText("0")));
expression.appendPart(collectionIndex);
} else if ("last".equals(value)) {
ExpressionFormLine index = new ExpressionFormLine(expression);
index.appendPart(new ExpressionMethod("size", "int", SuggestionCompletionEngine.TYPE_NUMERIC));
index.appendPart(new ExpressionText("-1"));
collectionIndex.putParam("index", index);
expression.appendPart(collectionIndex);
}
}
}