Class ShadowInfo

  • All Implemented Interfaces:
    java.io.Serializable, NodeInfo, Condition

    public class ShadowInfo
    extends java.lang.Object
    Represent a shadow element.
    Since:
    8.0.0
    Author:
    jumperchen
    See Also:
    Serialized Form
    • Constructor Detail

      • ShadowInfo

        public ShadowInfo​(NodeInfo parent,
                          ComponentDefinition compdef,
                          java.lang.String tag,
                          ConditionImpl cond)
        Creates a shadow.
        Parameters:
        parent - the parent node (never null)
        compdef - the component definition; never null
        tag - the tag name; Note: if component implements DynamicTag, this argument must be specified. If DynamicTag is not implemented, this argument is optional.
    • Method Detail

      • getAnnotationMap

        public AnnotationMap getAnnotationMap()
        Returns the annotation map defined in this info, or null if no annotation is ever defined.
      • addAnnotation

        public void addAnnotation​(java.lang.String propName,
                                  java.lang.String annotName,
                                  java.util.Map<java.lang.String,​java.lang.String[]> annotAttrs,
                                  Location loc)
        Adds an annotation to the specified property of this component info.
        Parameters:
        propName - the property name. If null, the annotation is associated with the whole component rather than a particular property.
        annotName - the annotation name (never null, nor empty).
        annotAttrs - a map of attributes, or null if no attribute at all. The attribute must be in a pair of strings (String name, String value), or (String name, String[] value).
        loc - the location information of the annotation in the document, or null if not available.
      • newInstance

        public Component newInstance​(Page page)
        Creates a shadow element based on this info (never null). It is the same as newInstance(page, null).

        If the implementation class doesn't have any EL expression, or its EL expression doesn't have reference to the self variable, the result is the same.

        This method is preserved for backward compatibility. It is better to use newInstance(Page, Component).

      • getComponentDefinition

        public ComponentDefinition getComponentDefinition()
        Returns the component definition, or null if it is PageDefinition.
      • getProperties

        public java.util.List<Property> getProperties()
        Returns a readonly list of properties (Property) (never null).
      • addProperty

        public void addProperty​(java.lang.String name,
                                java.lang.String value,
                                ConditionImpl cond)
        Adds a property initializer. It will initialize a component when created with this info.
        Parameters:
        name - the member name. The component must have a valid setter for it.
        value - the value. It might contain expressions (${}).
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hasBindingAnnotation

        public boolean hasBindingAnnotation()
      • enableBindingAnnotation

        public void enableBindingAnnotation()
      • disableBindingAnnotation

        public void disableBindingAnnotation()
      • isAnnotationNamespacedRoot

        public boolean isAnnotationNamespacedRoot()
        Returns:
        whether this ShadowInfo is the first ShadowInfo that has annotation namespace or binding annotation.
        Since:
        8.5.2
      • setAnnotationNamespacedRoot

        public void setAnnotationNamespacedRoot​(boolean annotationNamespacedRoot)
        Sets whether this ShadowInfo is the first ShadowInfo that has annotation namespace or binding annotation.
        Parameters:
        annotationNamespacedRoot -
        Since:
        8.5.2
      • getCondition

        public ConditionImpl getCondition()
        Returns the effectiveness condition.
      • setCondition

        public void setCondition​(ConditionImpl cond)
        Sets the effectiveness condition.
      • withCondition

        public boolean withCondition()
        Tests if the condition is set
      • isEffective

        public boolean isEffective​(Component comp)
        Description copied from interface: Condition
        Used to evaluate whether it is effective.
        Specified by:
        isEffective in interface Condition
        Parameters:
        comp - used as the self variable. Ignored if null.
      • isEffective

        public boolean isEffective​(Page page)
        Description copied from interface: Condition
        Used to evaluate whether it is effective.
        Specified by:
        isEffective in interface Condition
        Parameters:
        page - used as the self variable. Ignored if null.
      • getPageDefinition

        public PageDefinition getPageDefinition()
        Description copied from interface: NodeInfo
        Returns the page definition, i.e., the root node, or null if not available.
        Specified by:
        getPageDefinition in interface NodeInfo
      • getParent

        public NodeInfo getParent()
        Description copied from interface: NodeInfo
        Returns the parent, or null if it has no parent.
        Specified by:
        getParent in interface NodeInfo