- Type Parameters:
 G- the GUI's type
- All Known Implementing Classes:
 AbstractEntry
public interface Entry<G>
The base class for objects that store generated information about a GUI.
 
 This class model is not thread-safe in its internal implementation but
 could be so, if en own implementation would be provided. The reading/
 generation process is as easy as it could be. Just follow the execution
 workflow presented at the SwingReader declaration.
 
The standard way how to create a simple GUI is the following:
     Entry<MyGUI> entry = Entry.of(MyGUI.class);
 - Since:
 - 1.0
 - See Also:
 SwingReader,SwingLinker,FieldReference
- 
Method Summary
Modifier and Type Method Description FieldReference<?>getDeclaredField(java.lang.String name)Returns a field reference that is mapped to the given name.<V> FieldReference<V>getDeclaredField(java.lang.String name, java.lang.Class<V> cls)Returns a field reference that is mapped to the given name.FieldReference<?>[]getDeclaredFields()Returns an array ofFieldReferenceobjects reflecting all the fields declared by the GUI class.GgetGUI()Returns the GUI-object stored in thisEntry.Entry<?>getNestedGUI(java.lang.String name)If nested GUIs are provided they can be fetched from here.<T_G> Entry<T_G>getNestedGUI(java.lang.String name, java.lang.Class<T_G> type)If nested GUIs are provided they can be fetched from here.Entry<?>[]getNestedGUIs()Returns all nested GUI entries.java.lang.Class<G>getType()voidlinkAction(java.lang.Object src)Searches for theActionHandlerannotation and tries to link the given EventListener to the specified target.<T extends java.util.EventListener>
booleanlinkAction(java.lang.String fieldName, java.lang.Class<T> cls, T listener)Tries to link the given EventListener to the specified target.static <R> Entry<R>of(java.lang.Class<R> cls, java.lang.Object... args)Generates a new GUI from the given class.<V> voidputField(FieldReference<V> reference)Tries to insert the given field and throws an exception on error.<T_G> voidputNestedGUI(java.lang.String name, Entry<T_G> entry)Tries to insert the given nested GUI entry and throws an exception on error.voidsetGUI(G gui)Applies a new gui value.voidstart(java.lang.Object... args)Searches for theEntryPointannotation and executes the method with it. 
- 
Method Details
- 
of
static <R> Entry<R> of(java.lang.Class<R> cls, java.lang.Object... args) throws java.lang.ExceptionGenerates a new GUI from the given class. This method provides the internal implementation of theEntryinterface. It can be used by default, but should be replaced in future releases.For the basic execution workflow see
SwingReader. The usedEntryimplementation makes use of theHashMapto store field reference objects.It is also possible to provide constructor arguments for the given GUI class. They will be used to create an object of type
<R>.- Type Parameters:
 R- the GUI type- Parameters:
 cls- the GUI's classargs- the constructor arguments- Returns:
 - a new GUI instance
 - Throws:
 java.lang.Exception- if an error occurs
 - 
getGUI
G getGUI()Returns the GUI-object stored in thisEntry. This method will throw aNullPointerExceptionif the given instance isnull.- Returns:
 - the stored GUI instance
 - Throws:
 java.lang.NullPointerException- if the stored GUI isnull
 - 
setGUI
Applies a new gui value.- Parameters:
 gui- the new GUI instance
 - 
getType
java.lang.Class<G> getType()- Returns:
 - The GUI's type
 
 - 
getNestedGUI
If nested GUIs are provided they can be fetched from here.- Type Parameters:
 T_G- the GUI type- Parameters:
 name- the field's nametype- gui's class type- Returns:
 - the 
Entrystoring all information about the GUI 
 - 
getNestedGUI
If nested GUIs are provided they can be fetched from here.- Parameters:
 name- the field's name- Returns:
 - the 
Entrystoring all information about the GUI 
 - 
getNestedGUIs
Entry<?>[] getNestedGUIs()Returns all nested GUI entries.- Returns:
 - all nested GUI entries
 
 - 
putNestedGUI
<T_G> void putNestedGUI(java.lang.String name, Entry<T_G> entry) throws java.lang.NullPointerException, java.nio.channels.AlreadyBoundExceptionTries to insert the given nested GUI entry and throws an exception on error.- Type Parameters:
 T_G- the GUI type- Parameters:
 name- the field's nameentry- theEntryobject- Throws:
 java.lang.NullPointerException- if the given reference isnulljava.nio.channels.AlreadyBoundException- if there is already a mapping with the field's name
 - 
getDeclaredField
Returns a field reference that is mapped to the given name. The name will be the same as the one at the field's declaration.- Parameters:
 name- the field's name- Returns:
 - the corresponding 
FieldReference;nullif no mapping exists for the given name. 
 - 
getDeclaredField
<V> FieldReference<V> getDeclaredField(java.lang.String name, java.lang.Class<V> cls) throws java.lang.ClassCastExceptionReturns a field reference that is mapped to the given name. The name will be the same as the one at the field's declaration.This method will fail if the provided class type is not an assignable form of the stored one.
- Type Parameters:
 V- the component's type- Parameters:
 name- the field's namecls- the component class type- Returns:
 - the corresponding 
FieldReference;nullif no mapping exists for the given name. - Throws:
 java.lang.ClassCastException- if there is an error while casting
 - 
putField
<V> void putField(FieldReference<V> reference) throws java.lang.NullPointerException, java.nio.channels.AlreadyBoundExceptionTries to insert the given field and throws an exception on error.- Type Parameters:
 V- the component type- Parameters:
 reference- the field's reference- Throws:
 java.lang.NullPointerException- if the given reference isnulljava.nio.channels.AlreadyBoundException- if there is already a mapping with the field's name
 - 
getDeclaredFields
FieldReference<?>[] getDeclaredFields()Returns an array ofFieldReferenceobjects reflecting all the fields declared by the GUI class.- Returns:
 - an array of 
FieldReferenceobjects 
 - 
start
void start(java.lang.Object... args) throws java.lang.NullPointerExceptionSearches for theEntryPointannotation and executes the method with it.- Parameters:
 args- the method's arguments- Throws:
 java.lang.NullPointerException- if no method was found
 - 
linkAction
void linkAction(java.lang.Object src)Searches for theActionHandlerannotation and tries to link the given EventListener to the specified target.- Parameters:
 src- the event listener object
 - 
linkAction
<T extends java.util.EventListener> boolean linkAction(java.lang.String fieldName, java.lang.Class<T> cls, T listener)Tries to link the given EventListener to the specified target.- Type Parameters:
 T- the listener type- Parameters:
 fieldName- the target field namecls- the listener base classlistener- the event listener object- Returns:
 trueif the listener has been added successfully
 
 -