Package dsto.dfc.util

Miscellaneous utility classes.

See:
          Description

Interface Summary
ClassInstantiationListener Defines a listener for class instantiation events.
Copyable Extends the java.lang.Cloneable interface to guarantee that clone () is public, rather than protected as defined by Object.
Disposable Defines an object that supports explicit destruction.
EnumerationValue Defines a value that is part of an enumerated set of values.
ITranslator Defines an object that translates objects from one form to another.
JavaBean Marker interface for JavaBean's.
PropertyEventSource Interface for classes that fire PropertyChangeEvent's.
Singleton A marker interface to identify classes that have only one instance per VM.
StateChangeListener Defines a listener to state change events.
 

Class Summary
AbstractEnumerationValue Base class for enumerated types.
AbstractNamedObject Abstract base class for objects with a name that (at least partially) defines their identity.
BasicClassInstantiationEventSource Basic support class for managing ClassInstantiation listeners.
BasicPropertyEventSource Base implementation of PropertyEventSource.
Beans Utilities for messing with JavaBeans.
BrowserControl (mpp) Note: this code is based on 1.4b1 of BrowserLauncher.java from http://browserlauncher.sourceforge.net/.
CategoryComparator Comparator that sorts by a major category and then by a Collator.
ClassInstantiationEvent Defines a class instantiation event.
CronDaemon A simple cron-like daemon thread that notifies clients at regular intervals.
Debug Debugging utilities.
DefaultComparator Default comparator instance that will compare anything thrown at it in a semi-sensible way.
DfcProperties Simple extension of Java Properties class to add convenience methods.
DfcSystem DFC system utilities.
EventListenerList A generic list of event listeners.
Files General file utilities
IndentPrintWriter Extension of PrintWriter that provides auto-indent.
Math  
MixedTypeComparator A comparator that tries to intelligently order various mixed value types.
MultiplexedThread Allows a thread to be multiplexed into several scheduled Runnable's.
NamedObject Base class for objects with a name that (at least partially) defines their identity.
Objects Utility methods for manipulating objects.
ReverseComparator Revereses the normal order of a Comparator.
RunnableEventCallback Used to deliver an event from a Runnable.
Scheduler A lightweight task scheduler thread similar to java.util.Timer.
Scheduler.Task Base class for tasks that can be scheduled.
StateChangeEvent An event fired by an object to indicate its state has changed in some way.
StringComparator Compares objects using their stringified (toString ()) form.
StringEnumerationValue Base class for enumerated types that have a string representation.
StringTranslator Translates any value to a string using toString ().
TaskDelegate A delegate that calls a wrapped delegate as a Task on the supplied scheduler
TimerCallback Used to deliver an event from java.util.Timer.
Timers General routines for the java.util.Timer class including timer pool factory methods.
UniqueObject A unique object that only equals itself.
WeakEventListener A 'weak' event listener proxy that does not preclude garbage collection of the listener.
 

Exception Summary
IllegalFormatException Indicates an illegal format has been detected.
InvalidFormatException Used to indicate an invalid format, eg while parsing a document and finding an invalid field value.
MissingParameterException Used to indicate that a missing parameter value was detected.
 

Error Summary
AssertionFailedException Thrown to indicate a debugging assertion has failed.
 

Package dsto.dfc.util Description

Miscellaneous utility classes.

Enumerations

Enumerated values are enabled via the dsto.dfc.util.Enumeration interface. An enumerated type implements the Enumeration interface and has a method, getEnumValues (), that returns the set of possible values in the enumeration. The dsto.dfc.util.StringEnumeration and dsto.dfc.util.IconicEnumeration classes provide useful bases for enumerated types. Also see dsto.dfc.ui.EnumComboBox for a way of selecting from enumerations in a UI.

Example:

    public class ColorEnumeration extends StringEnumeration
    {
      public static final ColorEnumeration RED =
        new ColorEnumeration ("Red", Color.red);

      public static final ColorEnumeration GREEN =
        new ColorEnumeration ("Green", Color.green);

      public static final ColorEnumeration YELLOW =
        new ColorEnumeration ("Yellow", Color.yellow);

      private static final ColorEnumeration [] COLORS =
        new ColorEnumeration [] {RED, GREEN, YELLOW};
         
      protected transient Color color;

      protected ColorEnumeration (String name, Color color)
      {
        super (name);
        
        this.color = color;
      }

      public Enumeration [] getEnumValues ()
      {
        return COLORS;
      }

      public Color getColor ()
      {
        return color;
      }

      /**
       * This calls readResolve () in AbstractEnumeration which ensures that
       * all deserialized instances of ColorEnumeration are resolved to one
       * of the values in the COLORS array using the enumeration's equals ()
       * method.  This is why color can be transient - deserialized values
       * of this class are never seen by the outside world.
       */
      protected Object readResolve () throws InvalidObjectException
      {
        return super.readResolve ();
      }
    }
  



Copyright © 2008 Commonwealth of Australia