Package com.aoapps.html.any


package com.aoapps.html.any

Interface hierarchy, abstract base classes, and overall relationship between document, element, attributes, and content.

This package makes extensive use of parameterized types, many of them self-referential. This is primarily so that code-assistance can provide the full context of the current element/attribute/content. The verbosity caused by the expanding type parameters is not expected to be intrusive for two reasons: var is available for local variables in newer versions of Java, and the type definitions provide meaningful limits to wildcard bounds (<?>).

Naming conventions within the package:

  • ELEMENT - Classes that represent HTML elements.

  • ELEMENT__ - Non-closeable, lambda-friendly content of HTML elements (tag is automatically ended when lambda execution completes).

  • ELEMENT_c - Closeable HTML element content, which must be explicitly closed to end the tag (with either Closeable.close() or Closeable.__(), the latter allowing further fluent method chaining). This is useful when the opening tag and closing tag are written at different times or in different parts of the code. For example, when creating a template where one method writes the template header and a different method writes the template footer.

  • ELEMENT_content - Content model interface specific to a single type of element. This interface, or one of the more general-purpose *Content models, is implemented by both ELEMENT__ and ELEMENT_c.

  • *Content - Various content model interfaces, either directly defined by the HTML specification or a result of adapting the HTML specification into an interface hierarchy.

  • Union_* - Union content models represent the specific elements that are common between two or more content models, but where the content models cannot inherit from one another. These interfaces are not specifically part of the HTML specification, but are an artifact of this implementation. These interfaces are primarily needed because there is no "or" for generic upper bounds.

    For example, both AnyB and AnyI are part of both AnyPalpableContent and AnyPhrasingContent. Thus, when you have one, you know you can have the other (see AnyUnion_Palpable_Phrasing in this case).