public class ActivationDataFlavor
extends java.lang.Object
java.awt.datatransfer.DataFlavor
class. It allows
Jakarta Activation 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.Constructor and Description |
---|
ActivationDataFlavor(java.lang.Class<?> representationClass,
java.lang.String humanPresentableName)
Construct an ActivationDataFlavor that represents a MimeType.
|
ActivationDataFlavor(java.lang.Class<?> representationClass,
java.lang.String mimeType,
java.lang.String humanPresentableName)
Construct an ActivationDataFlavor that represents an arbitrary
Java object.
|
ActivationDataFlavor(java.lang.String mimeType,
java.lang.String humanPresentableName)
Construct an ActivationDataFlavor that represents a MimeType.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(ActivationDataFlavor dataFlavor)
Compares the ActivationDataFlavor passed in with this
ActivationDataFlavor; calls the
isMimeTypeEqual method. |
boolean |
equals(java.lang.Object o) |
boolean |
equals(java.lang.String s)
Deprecated.
As inconsistent with
hashCode() contract,
use isMimeTypeEqual(String) instead. |
java.lang.String |
getHumanPresentableName()
Return the Human Presentable name.
|
java.lang.String |
getMimeType()
Return the MIME type for this ActivationDataFlavor.
|
java.lang.Class<?> |
getRepresentationClass()
Return the representation class.
|
int |
hashCode()
Returns hash code for this
ActivationDataFlavor . |
boolean |
isMimeTypeEqual(java.lang.String mimeType)
Is the string representation of the MIME type passed in equivalent
to the MIME type of this ActivationDataFlavor.
|
protected java.lang.String |
normalizeMimeType(java.lang.String mimeType)
Deprecated.
|
protected java.lang.String |
normalizeMimeTypeParameter(java.lang.String parameterName,
java.lang.String parameterValue)
Deprecated.
|
void |
setHumanPresentableName(java.lang.String humanPresentableName)
Set the human presentable name.
|
public ActivationDataFlavor(java.lang.Class<?> representationClass, java.lang.String mimeType, java.lang.String humanPresentableName)
The returned ActivationDataFlavor will have the following characteristics:
representationClass = representationClass
mimeType = mimeType
humanName = humanName
representationClass
- the class used in this ActivationDataFlavormimeType
- the MIME type of the data represented by this classhumanPresentableName
- the human presentable name of the flavorpublic ActivationDataFlavor(java.lang.Class<?> representationClass, java.lang.String humanPresentableName)
The returned ActivationDataFlavor will have the following characteristics:
If the mimeType is "application/x-java-serialized-object; class=", the result is the same as calling new ActivationDataFlavor(Class.forName()) as above.
otherwise:
representationClass = InputStream
mimeType = mimeType
representationClass
- the class used in this ActivationDataFlavorhumanPresentableName
- the human presentable name of the flavorpublic ActivationDataFlavor(java.lang.String mimeType, java.lang.String humanPresentableName)
The returned ActivationDataFlavor will have the following characteristics:
If the mimeType is "application/x-java-serialized-object; class=", the result is the same as calling new ActivationDataFlavor(Class.forName()) as above, otherwise:
representationClass = InputStream
mimeType = mimeType
mimeType
- the MIME type of the data represented by this classhumanPresentableName
- the human presentable name of the flavorpublic java.lang.String getMimeType()
public java.lang.Class<?> getRepresentationClass()
public java.lang.String getHumanPresentableName()
public void setHumanPresentableName(java.lang.String humanPresentableName)
humanPresentableName
- the name to setpublic boolean equals(ActivationDataFlavor dataFlavor)
isMimeTypeEqual
method.dataFlavor
- the ActivationDataFlavor to compare withpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the Object
to compare with@Deprecated public boolean equals(java.lang.String s)
hashCode()
contract,
use isMimeTypeEqual(String)
instead.mimeType
against the passed in
String
and representationClass
is
not considered in the comparison.
If representationClass
needs to be compared, then
equals(new DataFlavor(s))
may be used.s
- the mimeType
to compare.s
is null
public int hashCode()
ActivationDataFlavor
.
For two equal ActivationDataFlavor
s, hash codes are equal.
For the String
that matches ActivationDataFlavor.equals(String)
, it is not
guaranteed that ActivationDataFlavor
's hash code is equal
to the hash code of the String
.hashCode
in class java.lang.Object
ActivationDataFlavor
public boolean isMimeTypeEqual(java.lang.String mimeType)
ActivationDataFlavor delegates the comparison of MIME types to the MimeType class included as part of Jakarta Activation.
mimeType
- the MIME type@Deprecated protected java.lang.String normalizeMimeTypeParameter(java.lang.String parameterName, java.lang.String parameterValue)
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.
parameterName
- the parameter nameparameterValue
- the parameter value@Deprecated protected java.lang.String normalizeMimeType(java.lang.String mimeType)
mimeType
- the MIME type