Class AbstractSwingHandler<A extends java.lang.annotation.Annotation>

java.lang.Object
org.proto4j.swing.core.handler.AbstractSwingHandler<A>
Type Parameters:
A - the annotation type
All Implemented Interfaces:
SwingHandler
Direct Known Subclasses:
BasicOptionHandler, BoundsHandler, LayoutHandler, MarginHandler, ModelHandler, PositionHandler, WindowHandler

public abstract class AbstractSwingHandler<A extends java.lang.annotation.Annotation>
extends java.lang.Object
implements SwingHandler
This class provides a generic implementation of a SwingHandler class. The basic execution flow is the following:
  1. Check if the annotation is present (Exception on failure)
  2. Retrieve the GenericDesc through getDesc(FieldReference, Annotation)
  3. Add the description to the ComponentDesc stored in the FieldReference
  4. Read the contents of the given annotation with GenericDesc.read(Annotation)
  5. Call GenericDesc.applyTo(Component) with the linked component from the FieldReference
The last three points should always be executed to prevent any unknown exceptions would be thrown.
Since:
1.0
See Also:
GenericDesc
  • Field Summary

    Fields inherited from interface org.proto4j.swing.core.SwingHandler

    CACHE
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractSwingHandler()  
  • Method Summary

    Modifier and Type Method Description
    protected abstract GenericDesc<A> getDesc​(FieldReference<?> reference, A value)
    Tries to create the GenericDesc object from the given reference and annotation value.
    void onElement​(FieldReference<?> reference, AnnotationContext<?> context)
    Handles the incoming FieldReference with its ComponentDesc and the references field.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.proto4j.swing.core.SwingHandler

    annotationType