}
}
}
// Go on with the build
TypeDeclaration type = new TypeDeclaration( typeDescr.getTypeName() );
if (typeDescr.getResource() == null) {
typeDescr.setResource(resource);
}
type.setResource( typeDescr.getResource() );
TypeDeclaration parent = null;
if (!typeDescr.getSuperTypes().isEmpty()) {
// parent might have inheritable properties
PackageRegistry sup = pkgRegistryMap.get( typeDescr.getSuperTypeNamespace() );
if ( sup != null ) {
parent = sup.getPackage().getTypeDeclaration( typeDescr.getSuperTypeName() );
if ( parent == null ) {
this.results.add( new TypeDeclarationError( typeDescr, "Declared class " + typeDescr.getTypeName() + " can't extend class " + typeDescr.getSuperTypeName() + ", it should be declared" ) );
} else {
if ( parent.getNature() == TypeDeclaration.Nature.DECLARATION && ruleBase != null ) {
// trying to find a definition
parent = ruleBase.getPackagesMap().get( typeDescr.getSuperTypeNamespace() ).getTypeDeclaration( typeDescr.getSuperTypeName() );
}
}
}
}
// is it a regular fact or an event?
AnnotationDescr annotationDescr = typeDescr.getAnnotation( TypeDeclaration.Role.ID );
String role = ( annotationDescr != null ) ? annotationDescr.getSingleValue() : null;
if (role != null) {
type.setRole( TypeDeclaration.Role.parseRole( role ) );
} else if ( parent != null ) {
type.setRole( parent.getRole() );
}
annotationDescr = typeDescr.getAnnotation( TypeDeclaration.ATTR_TYPESAFE );
String typesafe = ( annotationDescr != null ) ? annotationDescr.getSingleValue() : null;
if (typesafe != null) {
type.setTypesafe( Boolean.parseBoolean( typesafe ) );
} else if ( parent != null ) {
type.setTypesafe( parent.isTypesafe() );
}
// is it a pojo or a template?
annotationDescr = typeDescr.getAnnotation( TypeDeclaration.Format.ID );
String format = ( annotationDescr != null ) ? annotationDescr.getSingleValue() : null;