You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Gerhard Petracek (JIRA)" <ji...@apache.org> on 2013/12/10 09:33:07 UTC

[jira] [Created] (DELTASPIKE-465) provide DefaultViewConfigInheritanceStrategy#addViewMetaData as protected method

Gerhard Petracek created DELTASPIKE-465:
-------------------------------------------

             Summary: provide DefaultViewConfigInheritanceStrategy#addViewMetaData as protected method
                 Key: DELTASPIKE-465
                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-465
             Project: DeltaSpike
          Issue Type: Improvement
          Components: JSF-Module
    Affects Versions: 0.5
            Reporter: John Schneider
            Assignee: Gerhard Petracek
            Priority: Minor
             Fix For: 0.6


overriding DefaultViewConfigInheritanceStrategy#addViewMetaData allows to customize the default handling of stereotypes easily

e.g.:

{code}
public class CustomViewConfigInheritanceStrategy extends DefaultViewConfigInheritanceStrategy
{
    protected void addViewMetaData(List<Annotation> result, Annotation annotation, Class<? extends Annotation> annotationClass)
    {
        if (annotationClass.isAnnotationPresent(ViewMetaData.class) &&
                !annotationClass.isAnnotationPresent(Stereotype.class))  //customized
        {
            result.add(annotation);
        }
        else if (annotationClass.isAnnotationPresent(Stereotype.class))
        {
            for (Annotation inheritedViaStereotype : annotationClass.getAnnotations())
            {
                if (inheritedViaStereotype.annotationType().isAnnotationPresent(ViewMetaData.class))
                {
                    result.add(inheritedViaStereotype);
                }
            }
            result.add(annotation); //customized
        }
    }
}
{code}



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)