Class ConditionalTag

  • All Implemented Interfaces:
    ITextTag
    Direct Known Subclasses:
    IfTag, WhenTag

    public abstract class ConditionalTag
    extends Object
    implements ITextTag
    Represent the if tag from XML file to put dynamic SQLs.
    Since:
    0.0.2
    Author:
    Alisson Gomes
    • Constructor Detail

      • ConditionalTag

        public ConditionalTag​(String ognlExpression,
                              String text)
        Parses the given OGNL expression that can be used by Ognl static methods.
        Parameters:
        ognlExpression - the OGNL expression to be parsed
        text - content of expression to be evaluated
        Throws:
        MalformedExpression - if the expression is malformed or if there is a pathological environmental problem.
    • Method Detail

      • eval

        public boolean eval​(Object rootObjects)
        Evaluate the expression from test attribute is true or false.
        Specified by:
        eval in interface ITextTag
        Parameters:
        rootObjects - the root object for the OGNL expression.
        Returns:
        true if expression is true, false otherwise.
        See Also:
        Ognl
      • getText

        public String getText()
        Retrieve the text from XML element.
        Specified by:
        getText in interface ITextTag
        Returns:
        text from XML element.
      • getText

        public String getText​(Object rootObjects)
        Description copied from interface: ITextTag
        Evaluate if attribute test is true or false with OGNL expression. Something
        Specified by:
        getText in interface ITextTag
        Parameters:
        rootObjects - the root object for the OGNL expression.
        Returns:
        dynamic value evaluating rootObjects.
        See Also:
        Ognl
      • isDynamic

        public boolean isDynamic()
        Indicate if text is dynamic or static.
        Specified by:
        isDynamic in interface ITextTag
        Returns:
        always true is returned, because this object save dynamic text.
      • isDynamicGroup

        public boolean isDynamicGroup()
        Description copied from interface: ITextTag
        Indicate if text contains a dynamic group of tags like: SetTag and WhereTag.
        Specified by:
        isDynamicGroup in interface ITextTag
        Returns:
        true returned if dynamic, false otherwise.
      • getTags

        public List<? extends ITextTag> getTags()
        Description copied from interface: ITextTag
        Collections from inner tags (WhereTag, SetTag...)
        Specified by:
        getTags in interface ITextTag
        Returns:
        inner tags, empty list if tag doesn't store collection.