Uploaded image for project: 'Tiles'
  1. Tiles
  2. TILES-586

improve AttributeContext.getLocalAttribute for value retrieval

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.0.7
    • None
    • None
    • None

    Description

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

      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);
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            hurelhuyag hurelhuyag
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: