JDK-4656774 : Provide some convenient constructot for DataFlavor describing specific class.
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0_02
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2002-03-22
  • Updated: 2006-08-31
Related Reports
Relates :  
Relates :  
Description
There is missing convenient constructor for creating DataFlavor wich mime type is of DataFlavor.javaJVMLocalObjectMimeType (could be valid also for other type). And its parameter is class other one than the default. Then is necessary to type code like this:

DataFlavor df = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType
       + "; class=myPackageName.myClassName",
	 null,
	classloader // there is also constr without this parameter
);

which is very cumbersome. There is also necesary to keep in mind there is needed the space after semicolon otherwise the comparison of such DataFlavor instances will fail. All that is not mentioned in documentation, thus could discourage API users in this case.


I would expect to be able code like this:

DataFlavor df = new DataFlavor(DataFlavor.javaJVMObjectMimeType,
	myPackage.myClassName.class,
        classLoader // this would be optional (two costructors added?)
);