Interface Scope

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean addScopeListener​(ScopeListener listener)
      Adds a listener to listen whether this scope is changed.
      java.lang.Object getAttribute​(java.lang.String name)
      Returns the custom attribute associated with this object (scope).
      java.lang.Object getAttribute​(java.lang.String name, boolean recurse)
      Returns the custom attribute associated with this object.
      java.util.Map<java.lang.String,​java.lang.Object> getAttributes()
      Returns all custom attributes associated with this object (scope).
      boolean hasAttribute​(java.lang.String name)
      Returns if a custom attribute is associated with this object (scope).
      boolean hasAttribute​(java.lang.String name, boolean recurse)
      Returns if a custom attribute is associated with this object.
      java.lang.Object removeAttribute​(java.lang.String name)
      Removes the attribute from the current scope if any.
      java.lang.Object removeAttribute​(java.lang.String name, boolean recurse)
      Removes the custom attribute associated with this scope.
      boolean removeScopeListener​(ScopeListener listener)
      Removes a change listener from this scope.
      java.lang.Object setAttribute​(java.lang.String name, java.lang.Object value)
      Sets (a.k.a., associates) the value for a custom attribute with this object (scope).
      java.lang.Object setAttribute​(java.lang.String name, java.lang.Object value, boolean recurse)
      Sets the custom attribute associated with this scope, or the parent scope.
    • Method Detail

      • getAttributes

        java.util.Map<java.lang.String,​java.lang.Object> getAttributes()
        Returns all custom attributes associated with this object (scope).
      • getAttribute

        java.lang.Object getAttribute​(java.lang.String name)
        Returns the custom attribute associated with this object (scope).
      • getAttribute

        java.lang.Object getAttribute​(java.lang.String name,
                                      boolean recurse)
        Returns the custom attribute associated with this object.
        Parameters:
        recurse - whether to search its ancestor scope. If true and the current scope doen't define the attribute, it searches up its ancestor to see any of them has defined the specified attribute.
        Since:
        5.0.0
      • hasAttribute

        boolean hasAttribute​(java.lang.String name)
        Returns if a custom attribute is associated with this object (scope).

        Notice that null is a valid value, so you can tell if an attribute is associated by examining the return value of getAttribute(java.lang.String).

        Since:
        5.0.0
      • hasAttribute

        boolean hasAttribute​(java.lang.String name,
                             boolean recurse)
        Returns if a custom attribute is associated with this object.

        Notice that null is a valid value, so you can tell if an attribute is associated by examining the return value of getAttribute(java.lang.String).

        Parameters:
        recurse - whether to search its ancestor scope. If true and the current scope doen't define the attribute, it searches up its ancestor to see any of them has defined the specified attribute.
        Since:
        5.0.0
      • setAttribute

        java.lang.Object setAttribute​(java.lang.String name,
                                      java.lang.Object value)
        Sets (a.k.a., associates) the value for a custom attribute with this object (scope).
        Returns:
        the previous value associated with the attribute, if any
        Since:
        5.0.0
      • setAttribute

        java.lang.Object setAttribute​(java.lang.String name,
                                      java.lang.Object value,
                                      boolean recurse)
        Sets the custom attribute associated with this scope, or the parent scope.
        Parameters:
        recurse - whether to look up the parent scope for the existence of the attribute.
        If recurse is true and the attribute is defined in one of its ancestor (including page), the attribute is replaced. Otherwise, it is the same as setAttribute(String,Object).
        Since:
        5.0.0
      • removeAttribute

        java.lang.Object removeAttribute​(java.lang.String name)
        Removes the attribute from the current scope if any.
        Returns:
        the previous value associated with the attribute, if any,
        Since:
        5.0.0
      • removeAttribute

        java.lang.Object removeAttribute​(java.lang.String name,
                                         boolean recurse)
        Removes the custom attribute associated with this scope.
        Parameters:
        recurse - whether to look up the parent scope for the existence of the attribute.
        If recurse is true and the attribute is defined in one of its ancestor (including page), the attribute is removed. Otherwise, it is the same as removeAttribute(String).
        Since:
        5.0.0
      • addScopeListener

        boolean addScopeListener​(ScopeListener listener)
        Adds a listener to listen whether this scope is changed. The listener is called when a custom attribute is added, removed, or the parent is changed.
        Returns:
        weather the listener is added successfully. Note: if the resolver was added before, it won't be added again and this method returns false.
        Since:
        5.0.0
      • removeScopeListener

        boolean removeScopeListener​(ScopeListener listener)
        Removes a change listener from this scope.
        Returns:
        false if listener is not added before.
        Since:
        5.0.0