java.lang.Object
org.proto4j.swing.core.SwingReader
- All Implemented Interfaces:
java.lang.AutoCloseable
public class SwingReader
extends java.lang.Object
implements java.lang.AutoCloseable
A basic class which is used by parent classes to delegate the creation
process of the GUI object.
This class is designed to be used in a try-catch resource statement. It will close automatically after the statement is finished. For example,
Entry<MyGUI> entry = ... try (SwingReader reader = new SwingReader()) { reader.read(entry, arguments); SwingLinker.readEntry(entry); } //...Note the
SwingLinker
statement above - it is used to execute all
defined 'init' methods from the Option
annotation and tries to
bind each component to their specified parent component- Since:
- 1.0
- See Also:
AutoCloseable
-
Constructor Summary
Constructors Constructor Description SwingReader()
-
Method Summary
-
Constructor Details
-
SwingReader
public SwingReader()
-
-
Method Details
-
read
Tries to fill the givenEntry
with a GUI instance and all possibleFieldReference
objects.- Type Parameters:
T_GUI
- the GUI type- Parameters:
entry
- the entry to be filledargs
- constructor arguments for the GUI-class- Throws:
java.lang.Exception
- if an error occurs
-
isClosed
public boolean isClosed()- Returns:
- Whether this reader is already closed or still can be used
-
close
public void close() throws java.lang.ExceptionCloses this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by thetry
-with-resources statement.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.lang.Exception
- if this resource cannot be closed
-