Top Description Fields Constructors Methods
jakarta.activation

public Class ActivationDataFlavor

extends Object
Class Inheritance
Imports
java.io.IOException, jakarta.activation.MimeType

The ActivationDataFlavor class is similar to the JDK's 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.

Field Summary

Modifier and TypeField and Description
private String
private MimeType
private String
private Class<?>

Constructor Summary

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

Construct an ActivationDataFlavor that represents an arbitrary Java object.

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

Construct an ActivationDataFlavor 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 an ActivationDataFlavor 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
(ActivationDataFlavor
the ActivationDataFlavor to compare with
dataFlavor
)

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

public boolean

Returns:

true if the object is also an ActivationDataFlavor and is equal to this
equals
(Object
the Object to compare with
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public boolean

Returns:

true if the String (MimeType) is equal; false otherwise or if s is null
equals
(String
the mimeType to compare.
s
)
Deprecated As inconsistent with hashCode() contract, use isMimeTypeEqual(String) instead.

Compares only the mimeType against the passed in String and representationClass is not considered in the comparison.

public String

Returns:

the human presentable name
getHumanPresentableName
()

Return the Human Presentable name.

public String

Returns:

the MIME type
getMimeType
()

Return the MIME type for this ActivationDataFlavor.

public Class<?>

Returns:

the representation class
getRepresentationClass
()

Return the representation class.

public int

Returns:

a hash code for this ActivationDataFlavor
hashCode
()

Overrides java.lang.Object.hashCode.

Returns hash code for this ActivationDataFlavor.

public boolean

Returns:

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

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

protected String

Returns:

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

Called for each MIME type string to give ActivationDataFlavor 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
)
Deprecated

Called on ActivationDataFlavor for every MIME Type parameter to allow ActivationDataFlavor 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
)

Set the human presentable name.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

humanPresentableNameback to summary
private String humanPresentableName
mimeObjectback to summary
private MimeType mimeObject
mimeTypeback to summary
private String mimeType
representationClassback to summary
private Class<?> representationClass

Constructor Detail

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

Construct an ActivationDataFlavor that represents an arbitrary Java object.

The returned ActivationDataFlavor will have the following characteristics:

representationClass = representationClass
mimeType = mimeType
humanName = humanName

Parameters
representationClass:Class<?>

the class used in this ActivationDataFlavor

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<?> representationClass, String humanPresentableName)

Construct an ActivationDataFlavor that represents a MimeType.

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

Parameters
representationClass:Class<?>

the class used in this ActivationDataFlavor

humanPresentableName:String

the human presentable name of the flavor

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

Construct an ActivationDataFlavor that represents a MimeType.

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

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(ActivationDataFlavor dataFlavor)

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

Parameters
dataFlavor:ActivationDataFlavor

the ActivationDataFlavor to compare with

Returns:boolean

true if the MIME type and representation class are the same

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the Object to compare with

Returns:boolean

true if the object is also an ActivationDataFlavor and is equal to this

equalsback to summary
public boolean equals(String s)

Deprecated

As inconsistent with hashCode() contract, use isMimeTypeEqual(String) instead.

Compares only the 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.

Parameters
s:String

the mimeType to compare.

Returns:boolean

true if the String (MimeType) is equal; false otherwise or if s is null

Annotations
@Deprecated
getHumanPresentableNameback to summary
public String getHumanPresentableName()

Return the Human Presentable name.

Returns:String

the human presentable name

getMimeTypeback to summary
public String getMimeType()

Return the MIME type for this ActivationDataFlavor.

Returns:String

the MIME type

getRepresentationClassback to summary
public Class<?> getRepresentationClass()

Return the representation class.

Returns:Class<?>

the representation class

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns hash code for this ActivationDataFlavor. For two equal ActivationDataFlavors, 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.

Returns:int

a hash code for this ActivationDataFlavor

isMimeTypeEqualback to summary
public boolean isMimeTypeEqual(String mimeType)

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

ActivationDataFlavor delegates the comparison of MIME types to the MimeType class included as part of Jakarta Activation.

Parameters
mimeType:String

the MIME type

Returns:boolean

true if the same MIME type

normalizeMimeTypeback to summary
protected String normalizeMimeType(String mimeType)

Deprecated

Called for each MIME type string to give ActivationDataFlavor 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

Annotations
@Deprecated
normalizeMimeTypeParameterback to summary
protected String normalizeMimeTypeParameter(String parameterName, String parameterValue)

Deprecated

Called on ActivationDataFlavor for every MIME Type parameter to allow ActivationDataFlavor 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

Annotations
@Deprecated
setHumanPresentableNameback to summary
public void setHumanPresentableName(String humanPresentableName)

Set the human presentable name.

Parameters
humanPresentableName:String

the name to set