Clone wiki

AspectFaces / 4.Type-Mapping

Widgets are the independent aspect which needs to be weaved with fields of the processed entity. The weaving policy is defined as a set of rules, where you can declare data types related to given default widget. Besides that, you may declare other conditions for exceptions. Better then long explanation will be an example. This example assumes profile html (set of widgets) located in /WEB-INF/af/profile/html directory.

Mapping file

<?xml version="1.0" encoding="UTF-8"?>

        <default tag="html/text.xhtml" maxLength="255" size="30" required="false"/>
            expression="${not empty email and email == true}"
            expression="${not empty password and password == true}"

        <default tag="html/number.xhtml" maxLength="50" size="10" required="false"/>

        <default tag="html/entity.xhtml" required="false"/>

        <default tag="html/boolean.xhtml" required="false"/>

    <!-- Globally ignored fields -->


Mappings are considered as Aspect Faces profiles and you can choose between them by config attribute of af:ui tag. Mappings are usually named as profile-name.config.xml files and places into /WEB-INF/af.

Used variables are located in Aspect Faces context and set by Annotation Inspectors. For example, if the field is annotated with @Email and there is a proper inspector reading this annotation, it can set the email variable to true. About Annotation inspectors (named also Annotation Descriptors) keep reading.