[ Back | Previous | Next ]

How create a TO_CHAR function in TOPLINK expressions?

Package:
TOPLink.Public.Expressions.*
Product:
TOPLINK
Release:
2.0
Related Links:
General
General
General
General
General
Comment:
Creating the TO_CHAR function for conversion of dates in TOPLINK.

		ExpressionOperator toChar = new ExpressionOperator();
		toChar.addSelector("toChar");
		Vector s = new Vector();
		s.addElement("TO_CHAR(");
		s.addElement(", 'YYYYMMDD')");
		toChar.printsAs(s);
		toChar.bePrefix(); 
		toChar.setNodeClass(TOPLink.Private.Expressions.FunctionExpression.class);
		ExpressionOperator.initializeOperators();
		ExpressionOperator.addOperator(toChar);


Using the new expression

Expression expr = ExpressionOperator.getOperator("toChar").expressionFor(exp.get("fieldVaststellingsdatum")); datumExp = expr.equal( format(beginCal, "yyyyMMdd"));
1