hurelhuyag created TILES-586:
--------------------------------

             Summary: improve AttributeContext.getLocalAttribute for value 
retrieval
                 Key: TILES-586
                 URL: https://issues.apache.org/jira/browse/TILES-586
             Project: Tiles
          Issue Type: Improvement
    Affects Versions: 3.0.7
            Reporter: hurelhuyag
            Priority: Minor


AttributeContext.getLocalAttribute usage is to verbose. I think 
AttributeContext should be improved. This is my currently using 
BaseViewPreparer. 

{code:java}
public abstract class BaseViewPreparer implements ViewPreparer {

    @SuppressWarnings("unchecked")
    protected <T> T getLocalAttribute(String name, AttributeContext 
attributeContext, T defaultValue){
        Attribute attribute = attributeContext.getLocalAttribute(name);
        if (attribute != null){
            return (T) attribute.getValue();
        }else{
            return defaultValue;
        }
    }

    @Override
    public abstract void execute(Request tilesContext, AttributeContext 
attributeContext);
}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to