type.getTypeClass().getName(),
timestamp,
type.isTypesafe(),
results.getReturnType());
MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData("mvel");
data.addCompileable((MVELCompileable) reader);
((MVELCompileable) reader).compile(data);
type.setTimestampExtractor(reader);
} else {
kbuilder.addBuilderResult(new TypeDeclarationError(typeDescr,
"Error creating field accessors for timestamp field '" + timestamp +
"' for type '" +
type.getTypeName() +
"'"));
}
}
annotationDescr = typeDescr.getAnnotation(TypeDeclaration.ATTR_DURATION);
String duration = (annotationDescr != null) ? annotationDescr.getSingleValue() : null;
if (duration != null) {
type.setDurationAttribute(duration);
InternalKnowledgePackage pkg = pkgRegistry.getPackage();
MVELDialect dialect = (MVELDialect) pkgRegistry.getDialectCompiletimeRegistry().getDialect("mvel");
PackageBuildContext context = new PackageBuildContext();
context.init(kbuilder, pkg, typeDescr, pkgRegistry.getDialectCompiletimeRegistry(), dialect, null);
if (!type.isTypesafe()) {
context.setTypesafe(false);
}
MVELAnalysisResult results = (MVELAnalysisResult)
context.getDialect().analyzeExpression(context,
typeDescr,
duration,
new BoundIdentifiers(Collections.EMPTY_MAP,
Collections.EMPTY_MAP,
Collections.EMPTY_MAP,
type.getTypeClass()));
if (results != null) {
InternalReadAccessor reader = pkg.getClassFieldAccessorStore().getMVELReader(ClassUtils.getPackage(type.getTypeClass()),
type.getTypeClass().getName(),
duration,
type.isTypesafe(),
results.getReturnType());
MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData("mvel");
data.addCompileable((MVELCompileable) reader);
((MVELCompileable) reader).compile(data);
type.setDurationExtractor(reader);
} else {
kbuilder.addBuilderResult(new TypeDeclarationError(typeDescr,
"Error processing @duration for TypeDeclaration '" + type.getFullName() +