Class CodeColorizer

java.lang.Object
org.apache.sis.internal.book.CodeColorizer

public final class CodeColorizer extends Object
Apply syntax colorization on Java code. This class is different than most other colorization tools since its apply different colors depending on whether a word is known to be defined in an OGC/ISO standard, in GeoAPI or in Apache SIS.
Since:
0.7
Version:
1.3
Author:
Martin Desruisseaux (Geomatys)
  • Field Details

    • JAVA_KEYWORDS

      public static final Set<String> JAVA_KEYWORDS
      Lists of Java keywords.
  • Constructor Details

    • CodeColorizer

      public CodeColorizer(Document document) throws IOException, BookException
      Creates a new color colorizer.
      Parameters:
      document - the object to use for creating nodes.
      Throws:
      IOException - if an error occurred while reading the list of predefined identifiers.
      BookException - if an identifier is defined twice.
  • Method Details

    • highlight

      public void highlight(Node parent, String type) throws BookException
      Applies emphasing on the words found in all text node of the given node.
      Parameters:
      parent - the root element where to put Java keywords in bold characters. This is typically a <samp> or <code> element.
      type - "xml" if the element to process is XML rather than Java code.
      Throws:
      BookException - if an element cannot be processed.