Class FormattableObject

    • Constructor Detail

      • FormattableObject

        protected FormattableObject()
        Default constructor.
    • Method Detail

      • toString

        public String toString()
        Returns a Well Known Text (WKT) or an alternative text representation for this object. If this object can not be represented in a standard way, then this method may fallback on non-standard representation, or leave unformattable elements empty and append warnings after the WKT.

        By default this method formats this object according the Convention​.WKT2_SIMPLIFIED rules, except that Unicode characters are kept as-is (they are not converted to ASCII). Consequently the WKT is not guaranteed to be ISO 19162 compliant. For stricter conformance, use to­WKT() instead.

        to­String in class Object
        the Well Known Text (WKT) or an alternative representation of this object.
      • toString

        public String toString​(Convention convention)
        Returns a Well Known Text (WKT) for this object using the specified convention. Unicode characters are kept as-is (they are not converted to ASCII). The returned string may contain non-standard elements or warnings if this object can not be formatted according the given convention.

        For stricter conformance to ISO 19162 standard, use to­WKT() or WKTFormat instead.

        convention - the WKT convention to use.
        the Well Known Text (WKT) or a pseudo-WKT representation of this object.
      • print

        public void print()
        Prints a string representation of this object to the standard output stream. If a console is attached to the running JVM (i.e. if the application is run from the command-line and the output is not redirected to a file) and if Apache SIS thinks that the console supports the ANSI escape codes (a.k.a. X3.64), then a syntax coloring will be applied.

        This is a convenience method for debugging purpose and for console applications.

      • formatTo

        protected abstract String formatTo​(Formatter formatter)
        Formats the inner part of this Well Known Text (WKT) element into the given formatter. This method is automatically invoked by WKTFormat when a formattable element is found.

        Keywords, opening and closing brackets shall not be formatted here. For example if this formattable element is for a Geodetic­CRS[…] element, then this method shall write the content starting at the insertion point shown below:

        GeodeticCRS[ ]
            (insertion point)
        Formatting non-standard WKT
        If the implementation can not represent this object without violating some WKT constraints, it can uses its own (non-standard) keywords but shall declare that it did so by invoking one of the Formatter​.set­Invalid­WKT(…) methods.

        Alternatively, the implementation may also have no WKT keyword for this object. This happen frequently when an abstract class defines a base implementation, while the keyword needs to be defined by the concrete subclasses. In such case, the method in the abstract class shall return null.

        formatter - the formatter where to format the inner content of this WKT element.
        the CamelCase keyword for the WKT element, or null if unknown.
        See Also:
        to­WKT(), to­String()