For example, if we add this test case to drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/compiler/TypeDeclarationTest.java
@Test
public void testTypeDeclarationCustomMetadata() {
String str = "package org.example.custom; \n" +
"import " + Date.class.getCanonicalName() + ";\n" +
"import " + Address.class.getCanonicalName() + ";\n" +
"\n" +
"declare Person\n" +
" @author( Bob )\n" +
" @dateOfCreation( 01-Feb-2009 )\n" +
"\n" +
" name : String @key @maxLength( 30 )\n" +
" dateOfBirth : Date\n" +
" address : Address\n" +
"end";
KieBase kBase = KieBaseUtil.getKieBaseFromKieModuleFromDrl("test", kieBaseTestConfiguration, str);
FactType person = kBase.getFactType( "org.example.custom", "Person" );
Map<String, Object> personMetaData = person.getMetaData();
System.out.println("== Person Meta Data ==");
System.out.println(personMetaData);
FactField field = person.getField( "name" );
Map<String, Object> nameMetaData = field.getMetaData();
System.out.println("== name Meta Data ==");
System.out.println(nameMetaData);
}
non-exec-model
== Person Meta Data ==
{author=Bob, dateOfCreation=01-Feb-2009}
== name Meta Data ==
{key=null, maxLength=30}
exec-model
== Person Meta Data ==
null
== name Meta Data ==
null
For example, if we add this test case to
drools-test-coverage/test-compiler-integration/src/test/java/org/drools/mvel/compiler/compiler/TypeDeclarationTest.java
non-exec-model
exec-model