FileDocCategorySizeDatePackage
TransformAttribute.javaAPI DocJava SE 6 API4498Tue Jun 10 00:25:24 BST 2008java.awt.font

TransformAttribute

public final class TransformAttribute extends Object implements Serializable
The TransformAttribute class provides an immutable wrapper for a transform so that it is safe to use as an attribute.

Fields Summary
private AffineTransform
transform
The AffineTransform for this TransformAttribute, or null if AffineTransform is the identity transform.
public static final TransformAttribute
IDENTITY
A TransformAttribute representing the identity transform.
static final long
serialVersionUID
Constructors Summary
public TransformAttribute(AffineTransform transform)
Wraps the specified transform. The transform is cloned and a reference to the clone is kept. The original transform is unchanged. If null is passed as the argument, this constructor behaves as though it were the identity transform. (Note that it is preferable to use {@link #IDENTITY} in this case.)

param
transform the specified {@link AffineTransform} to be wrapped, or null.

        if (transform != null && !transform.isIdentity()) {
            this.transform = new AffineTransform(transform);
        }
    
Methods Summary
public booleanequals(java.lang.Object rhs)
Returns true if rhs is a TransformAttribute whose transform is equal to this TransformAttribute's transform.

param
rhs the object to compare to
return
true if the argument is a TransformAttribute whose transform is equal to this TransformAttribute's transform.
since
1.6

        try {
            TransformAttribute that = (TransformAttribute)rhs;
            if (transform == null) {
                return that.transform == null;
            }
            return transform.equals(that.transform);
        }
        catch (ClassCastException e) {
        }
        return false;
    
public java.awt.geom.AffineTransformgetTransform()
Returns a copy of the wrapped transform.

return
a AffineTransform that is a copy of the wrapped transform of this TransformAttribute.

        AffineTransform at = transform;
        return (at == null) ? new AffineTransform() : new AffineTransform(at);
    
public inthashCode()

since
1.6


           
       
        return transform == null ? 0 : transform.hashCode();
    
public booleanisIdentity()
Returns true if the wrapped transform is an identity transform.

return
true if the wrapped transform is an identity transform; false otherwise.
since
1.4

        return transform == null;
    
private java.lang.ObjectreadResolve()

        if (transform == null || transform.isIdentity()) {
            return IDENTITY;
        }
        return this;
    
private voidwriteObject(java.io.ObjectOutputStream s)


       
       
             
    
        // sigh -- 1.3 expects transform is never null, so we need to always write one out
        if (this.transform == null) {
            this.transform = new AffineTransform();
        }
        s.defaultWriteObject();