Top Description Fields Constructors Methods
javax.activation

public Class ActivationDataFlavor

extends DataFlavor
Class Inheritance
Imports
java.awt.datatransfer.DataFlavor, java.io.IOException, javax.activation.MimeType

The ActivationDataFlavor class is a special subclass of java.awt.datatransfer.DataFlavor. It allows the JAF to set all three values stored by the DataFlavor class via a new constructor. It also contains improved MIME parsing in the equals method. Except for the improved parsing, its semantics are identical to that of the JDK's DataFlavor class.

Field Summary

Modifier and TypeField and Description
private String
private MimeType
private String
private Class<T>
Inherited from java.awt.datatransfer.DataFlavor:
allHtmlFlavorfragmentHtmlFlavorimageFlavorjavaFileListFlavorjavaJVMLocalObjectMimeTypejavaRemoteObjectMimeTypejavaSerializedObjectMimeTypeplainTextFlavorselectionHtmlFlavorstringFlavor

Constructor Summary

AccessConstructor and Description
public
ActivationDataFlavor(Class<T>
the class used in this DataFlavor
representationClass
,
String
the MIME type of the data represented by this class
mimeType
,
String
the human presentable name of the flavor
humanPresentableName
)

Construct a DataFlavor that represents an arbitrary Java object.

public
ActivationDataFlavor(Class<T>
the class used in this DataFlavor
representationClass
,
String
the human presentable name of the flavor
humanPresentableName
)

Construct a DataFlavor that represents a MimeType.

public
ActivationDataFlavor(String
the MIME type of the data represented by this class
mimeType
,
String
the human presentable name of the flavor
humanPresentableName
)

Construct a DataFlavor that represents a MimeType.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the MIME type and representation class are the same
equals
(DataFlavor
the DataFlavor to compare with
dataFlavor
)

Overrides java.awt.datatransfer.DataFlavor.equals.

Compares the DataFlavor passed in with this DataFlavor; calls the isMimeTypeEqual method.
public String

Returns:

the human presentable name
getHumanPresentableName
()

Overrides java.awt.datatransfer.DataFlavor.getHumanPresentableName.

Return the Human Presentable name.
public String

Returns:

the MIME type
getMimeType
()

Overrides java.awt.datatransfer.DataFlavor.getMimeType.

Return the MIME type for this DataFlavor.
public Class<T>

Returns:

the representation class
getRepresentationClass
()

Overrides java.awt.datatransfer.DataFlavor.getRepresentationClass.

Return the representation class.
public boolean

Returns:

true if the same MIME type
isMimeTypeEqual
(String
the MIME type
mimeType
)

Overrides java.awt.datatransfer.DataFlavor.isMimeTypeEqual.

Is the string representation of the MIME type passed in equivalent to the MIME type of this DataFlavor.
protected String

Returns:

the normalized MIME type
normalizeMimeType
(String
the MIME type
mimeType
)

Overrides java.awt.datatransfer.DataFlavor.normalizeMimeType.

Deprecated
Called for each MIME type string to give DataFlavor subtypes the opportunity to change how the normalization of MIME types is accomplished.
protected String

Returns:

the normalized parameter value
normalizeMimeTypeParameter
(String
the parameter name
parameterName
,
String
the parameter value
parameterValue
)

Overrides java.awt.datatransfer.DataFlavor.normalizeMimeTypeParameter.

Deprecated
Called on DataFlavor for every MIME Type parameter to allow DataFlavor subclasses to handle special parameters like the text/plain charset parameters, whose values are case insensitive.
public void
setHumanPresentableName(String
the name to set
humanPresentableName
)

Overrides java.awt.datatransfer.DataFlavor.setHumanPresentableName.

Set the human presentable name.
Inherited from java.awt.datatransfer.DataFlavor:
cloneequalsequalsgetDefaultRepresentationClassgetDefaultRepresentationClassAsStringgetParametergetPrimaryTypegetReaderForTextgetSubTypegetTextPlainUnicodeFlavorhashCodeisFlavorJavaFileListTypeisFlavorRemoteObjectTypeisFlavorSerializedObjectTypeisFlavorTextTypeisMimeTypeEqualisMimeTypeSerializedObjectisRepresentationClassByteBufferisRepresentationClassCharBufferisRepresentationClassInputStreamisRepresentationClassReaderisRepresentationClassRemoteisRepresentationClassSerializablematchreadExternalselectBestTextFlavortoStringtryToLoadClasswriteExternal

Field Detail

humanPresentableNameback to summary
private String humanPresentableName

Hides java.awt.datatransfer.DataFlavor.humanPresentableName.

mimeObjectback to summary
private MimeType mimeObject
mimeTypeback to summary
private String mimeType

Hides java.awt.datatransfer.DataFlavor.mimeType.

representationClassback to summary
private Class<T> representationClass

Hides java.awt.datatransfer.DataFlavor.representationClass.

Constructor Detail

ActivationDataFlavorback to summary
public ActivationDataFlavor(Class<T> representationClass, String mimeType, String humanPresentableName)

Construct a DataFlavor that represents an arbitrary Java object. This constructor is an extension of the JDK's DataFlavor in that it allows the explicit setting of all three DataFlavor attributes.

The returned DataFlavor will have the following characteristics:

representationClass = representationClass
mimeType = mimeType
humanName = humanName

Parameters
representationClass:Class<T>

the class used in this DataFlavor

mimeType:String

the MIME type of the data represented by this class

humanPresentableName:String

the human presentable name of the flavor

ActivationDataFlavorback to summary
public ActivationDataFlavor(Class<T> representationClass, String humanPresentableName)

Construct a DataFlavor that represents a MimeType.

The returned DataFlavor will have the following characteristics:

If the mimeType is "application/x-java-serialized-object; class=", the result is the same as calling new DataFlavor(Class.forName()) as above.

otherwise:

representationClass = InputStream

mimeType = mimeType

Parameters
representationClass:Class<T>

the class used in this DataFlavor

humanPresentableName:String

the human presentable name of the flavor

ActivationDataFlavorback to summary
public ActivationDataFlavor(String mimeType, String humanPresentableName)

Construct a DataFlavor that represents a MimeType.

The returned DataFlavor will have the following characteristics:

If the mimeType is "application/x-java-serialized-object; class=", the result is the same as calling new DataFlavor(Class.forName()) as above, otherwise:

representationClass = InputStream

mimeType = mimeType

Parameters
mimeType:String

the MIME type of the data represented by this class

humanPresentableName:String

the human presentable name of the flavor

Method Detail

equalsback to summary
public boolean equals(DataFlavor dataFlavor)

Overrides java.awt.datatransfer.DataFlavor.equals.

Compares the DataFlavor passed in with this DataFlavor; calls the isMimeTypeEqual method.

Parameters
dataFlavor:DataFlavor

the DataFlavor to compare with

Returns:boolean

true if the MIME type and representation class are the same

getHumanPresentableNameback to summary
public String getHumanPresentableName()

Overrides java.awt.datatransfer.DataFlavor.getHumanPresentableName.

Return the Human Presentable name.

Returns:String

the human presentable name

getMimeTypeback to summary
public String getMimeType()

Overrides java.awt.datatransfer.DataFlavor.getMimeType.

Return the MIME type for this DataFlavor.

Returns:String

the MIME type

getRepresentationClassback to summary
public Class<T> getRepresentationClass()

Overrides java.awt.datatransfer.DataFlavor.getRepresentationClass.

Return the representation class.

Returns:Class<T>

the representation class

isMimeTypeEqualback to summary
public boolean isMimeTypeEqual(String mimeType)

Overrides java.awt.datatransfer.DataFlavor.isMimeTypeEqual.

Is the string representation of the MIME type passed in equivalent to the MIME type of this DataFlavor.

ActivationDataFlavor delegates the comparison of MIME types to the MimeType class included as part of the JavaBeans Activation Framework. This provides a more robust comparison than is normally available in the DataFlavor class.

Parameters
mimeType:String

the MIME type

Returns:boolean

true if the same MIME type

normalizeMimeTypeback to summary
protected String normalizeMimeType(String mimeType)

Overrides java.awt.datatransfer.DataFlavor.normalizeMimeType.

Deprecated

Called for each MIME type string to give DataFlavor subtypes the opportunity to change how the normalization of MIME types is accomplished. One possible use would be to add default parameter/value pairs in cases where none are present in the MIME type string passed in. This method is never invoked by this implementation.

Parameters
mimeType:String

the MIME type

Returns:String

the normalized MIME type

normalizeMimeTypeParameterback to summary
protected String normalizeMimeTypeParameter(String parameterName, String parameterValue)

Overrides java.awt.datatransfer.DataFlavor.normalizeMimeTypeParameter.

Deprecated

Called on DataFlavor for every MIME Type parameter to allow DataFlavor subclasses to handle special parameters like the text/plain charset parameters, whose values are case insensitive. (MIME type parameter values are supposed to be case sensitive).

This method is called for each parameter name/value pair and should return the normalized representation of the parameterValue. This method is never invoked by this implementation.

Parameters
parameterName:String

the parameter name

parameterValue:String

the parameter value

Returns:String

the normalized parameter value

setHumanPresentableNameback to summary
public void setHumanPresentableName(String humanPresentableName)

Overrides java.awt.datatransfer.DataFlavor.setHumanPresentableName.

Set the human presentable name.

Parameters
humanPresentableName:String

the name to set