Package net.sourceforge.plantuml.api.v2
Interface DiagramReturn
-
public interface DiagramReturn
Provides an interface to retrieve the results of a diagram processing operation. This interface allows for obtaining either aDiagram
object if the operation was successful, or an error message if the operation failed, along with the line number where the error occurred.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.awt.image.BufferedImage
asImage()
Converts the generated diagram to an image representation.java.lang.String
error()
Retrieves the error message associated with the diagram processing operation.Diagram
getDiagram()
Retrieves theDiagram
generated by the diagram processing operation.java.util.Optional<java.lang.Integer>
getErrorLine()
Retrieves the line number where an error occurred during the diagram processing operation.java.lang.Throwable
getRootCause()
Retrieves the root cause of the error occurred during the diagram processing operation.
-
-
-
Method Detail
-
getDiagram
Diagram getDiagram()
Retrieves theDiagram
generated by the diagram processing operation.- Returns:
- the generated
Diagram
, ornull
if there was an error during the diagram generation process, implying that no valid diagram could be created.
-
error
java.lang.String error()
Retrieves the error message associated with the diagram processing operation.- Returns:
- the error message if an error occurred, or
null
if the operation completed successfully and a valid diagram was produced.
-
getErrorLine
java.util.Optional<java.lang.Integer> getErrorLine()
Retrieves the line number where an error occurred during the diagram processing operation. This can help in debugging the source of the error in the input provided.- Returns:
- an
Optional
containing the line number of the error if an error occurred; otherwise, an emptyOptional
if the operation completed successfully without errors.
-
asImage
java.awt.image.BufferedImage asImage() throws java.io.IOException
Converts the generated diagram to an image representation. This can be useful for displaying the diagram in graphical user interfaces or for saving it as a file.- Returns:
- a
BufferedImage
representing the diagram. - Throws:
java.io.IOException
- if there is an error during the image generation process, such as an issue writing to a file or generating the image from the diagram.
-
getRootCause
java.lang.Throwable getRootCause()
Retrieves the root cause of the error occurred during the diagram processing operation. This method can be particularly useful for obtaining detailed information about exceptions that were caught during the processing of the diagram.- Returns:
- a
Throwable
object representing the root cause of the error, ornull
if the operation completed successfully without any exceptions.
-
-