Class AbstractDirective

    • Constructor Detail

      • AbstractDirective

        public AbstractDirective()
    • Method Detail

      • prepareReplacements

        protected abstract void prepareReplacements​(net.htmlparser.jericho.Source source,
                                                    Map<String,​String> replacements)
        Prepares all replacements to perform.
        Parameters:
        source - the initial source content.
        replacements - the map into which replacements MUST be specified. The key represents the occurrence into source, the value the replacements.
      • modifyElementAttribute

        protected void modifyElementAttribute​(net.htmlparser.jericho.StartTag linkStartTag,
                                              String attrName,
                                              UnaryOperator<String> newValue,
                                              Map<String,​String> replacements)
        Centralizes the modification of the value of an attribute.
        Parameters:
        linkStartTag - the StartTag instance of current element.
        attrName - the name of aimed attribute to modify.
        newValue - the Function implementation taking as parameter the current value of attribute and returns the modified one. Null parameter means that attribute does not yet exist.
        replacements - the map into which replacements MUST be specified. The key represents the occurrence into source, the value the replacements.
      • modifyElementAttributes

        protected void modifyElementAttributes​(net.htmlparser.jericho.StartTag linkStartTag,
                                               Collection<Pair<String,​UnaryOperator<String>>> attrDirectives,
                                               Map<String,​String> replacements)
        Centralizes the modification of the value of an attribute.
        Parameters:
        linkStartTag - the StartTag instance of current element.
        attrDirectives - collection of attributes directives. Each directive is represented by a Pair instance which on left is the name of the attribute and on the right the Function implementation taking as parameter the current value of attribute and returns the modified one. Null parameter means that attribute does not yet exist.
        replacements - the map into which replacements MUST be specified. The key represents the occurrence into source, the value the replacements.