Package docking.dnd

Class GenericDataFlavor

java.lang.Object
java.awt.datatransfer.DataFlavor
docking.dnd.GenericDataFlavor
All Implemented Interfaces:
Externalizable, Serializable, Cloneable

public class GenericDataFlavor extends DataFlavor
Generic data flavor class to override the equals(DataFlavor) method in order to have data flavors support the same general class types such as an ArrayList.
See Also:
  • Constructor Details

    • GenericDataFlavor

      public GenericDataFlavor()
      Construct a new GenericDataFlavor.
    • GenericDataFlavor

      public GenericDataFlavor(Class<?> representationClass, String humanPresentableName)
      Construct a GenericDataFlavor that represents a Java class
      Parameters:
      representationClass - the class used to transfer data in this flavor
      humanPresentableName - the human-readable string used to identify this flavor. If this parameter is null then the value of the the MIME Content Type is used.
    • GenericDataFlavor

      public GenericDataFlavor(String mimeType) throws ClassNotFoundException
      construct a GenericDataFlavor from a Mime Type string.
      Parameters:
      mimeType - he string used to identify the MIME type for this flavor The string must specify a "class=" parameter in order to succeed in constructing a DataFlavor.
      Throws:
      ClassNotFoundException - if the class could not be loaded
      IllegalArgumentException - thrown if mimeType does not specify a "class=" parameter
    • GenericDataFlavor

      public GenericDataFlavor(String mimeType, String humanPresentableName)
      Construct a GenericDataFlavor that represents a MimeType If the mimeType is "application/x-java-serialized-object; class=<representation class>", the result is the same as calling new GenericDataFlavor(Class:forName(<representation class>)
      Parameters:
      mimeType - the string used to identify the MIME type for this flavor
      humanPresentableName - the human-readable string used to identify this flavor
      Throws:
      IllegalArgumentException - thrown if the mimeType does not specify a "class=" parameter, or if the class is not successfully loaded
    • GenericDataFlavor

      public GenericDataFlavor(String mimeType, String humanPresentableName, ClassLoader classLoader) throws ClassNotFoundException
      Construct a GenericDataFlavor that represents a MimeType If the mimeType is "application/x-java-serialized-object; class=<representation class>", the result is the same as calling new GenericDataFlavor(Class:forName(<representation class>).
      Parameters:
      mimeType - the string used to identify the MIME type for this flavor
      humanPresentableName - the human-readable string used to identify this flavor.
      classLoader - class loader to load the class
      Throws:
      ClassNotFoundException - is thrown if class could not be loaded
  • Method Details

    • equals

      public boolean equals(DataFlavor dataFlavor)
      Return true if dataFlavor equals this generic data flavor.
      Overrides:
      equals in class DataFlavor
    • equals

      public boolean equals(Object obj)
      Return true if obj is equal this generic data flavor.
      Overrides:
      equals in class DataFlavor