Class Component<T extends Component<T>>

  • Type Parameters:
    T - type of component
    Direct Known Subclasses:
    SnippetComponent

    public class Component<T extends Component<T>>
    extends Object
    Base of Snippet component.
    Version:
    2.4
    Author:
    Christophe Friederich
    • Constructor Detail

      • Component

        protected Component​(@Nonnull
                            org.jsoup.nodes.Node node)
        Parameters:
        node - a node (can not be null).
    • Method Detail

      • createComponent

        public static Component<?> createComponent​(@Nonnull
                                                   org.jsoup.nodes.Node node,
                                                   Component<?> parent)
        Parameters:
        node - a node (can not be null).
        parent - the parent component
        Returns:
        the created component
      • getName

        public String getName()
        Returns:
        the name
      • isHtmlTag

        public boolean isHtmlTag()
        Returns:
      • getHtml

        public String getHtml()
        Returns:
        the html content
      • getOwnHtml

        public String getOwnHtml()
        Returns:
      • getParent

        public Component<?> getParent()
        Returns:
        the parent
      • getElement

        @Nullable
        protected org.jsoup.nodes.Element getElement()
      • get

        public Object get​(@Nonnull
                          String name)
        Parameters:
        name - the name
        Returns:
        the attribute or child component value
      • getAttribute

        public String getAttribute​(String name)
      • hasAttribute

        public boolean hasAttribute​(String name)
      • getAriaAttributes

        public Map<String,​String> getAriaAttributes()
        Returns:
        the ARIA attributes
      • getDataAttributes

        public Map<String,​String> getDataAttributes()
        Returns:
        the data attributes
      • getChildren

        public Components getChildren()
        Returns:
        the children
      • addChild

        public T addChild​(Component<?> component)
      • withParent

        protected T withParent​(Component<?> parent)
      • addAttributes

        protected T addAttributes​(@Nonnull
                                  org.jsoup.nodes.Attributes attrs)
        Parameters:
        attrs - list of attributes
        Returns:
        the fluent instance
      • addAttribute

        protected T addAttribute​(@Nonnull
                                 org.jsoup.nodes.Attribute attr)
        Parameters:
        attr - attribute
        Returns:
        the fluent instance
      • self

        protected T self()
        Returns:
        the fluent instance