org.nomin.core.ExprPathElem.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nomin Show documentation
Show all versions of nomin Show documentation
Nomin is a mapping engine for the Java platform. It provides abilities to transform object trees according to
declarative mapping rules. Main features of Nomin are no XML configuration, intuitively looking mapping,
using arbitrary expressions and method invocations in mappings, pre and postprocessing right in a mapping listing,
customizations. It's applicable for any Java compatible classes, not only JavaBeans.
package org.nomin.core
import org.nomin.util.TypeInfo
import org.nomin.util.TypeInfoFactory
/**
* Contains an expression or arbitrary value.
* @author Dmitry Dobrynin
* Created 09.04.2010 10:37:45
*/
class ExprPathElem extends PathElem {
def exprPathElementExpr
RuleElem createMappingRuleElement(TypeInfo ownerTypeInfo, TypeInfo hint, RuleElem prev) {
Closure.isInstance(exprPathElementExpr) ?
new ClosureRuleElem(exprPathElementExpr, TypeInfoFactory.typeInfo(Undefined).merge(hint)) :
new ValueRuleElem(exprPathElementExpr);
}
String toString() { Closure.isInstance(exprPathElementExpr) ? "{ expression }" : exprPathElementExpr }
}