1. /*
  2. * @(#)TransformAttribute.java 1.8 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. /*
  11. * (C) Copyright Taligent, Inc. 1996 - 1997, All Rights Reserved
  12. * (C) Copyright IBM Corp. 1996 - 1998, All Rights Reserved
  13. *
  14. * The original version of this source code and documentation is
  15. * copyrighted and owned by Taligent, Inc., a wholly-owned subsidiary
  16. * of IBM. These materials are provided under terms of a License
  17. * Agreement between Taligent and Sun. This technology is protected
  18. * by multiple US and International patents.
  19. *
  20. * This notice and attribution to Taligent may not be removed.
  21. * Taligent is a registered trademark of Taligent, Inc.
  22. *
  23. */
  24. package java.awt.font;
  25. import java.awt.geom.AffineTransform;
  26. import java.io.Serializable;
  27. /**
  28. * The <code>TransformAttribute</code> class provides an immutable
  29. * wrapper for a transform so that it is safe to use as an attribute.
  30. */
  31. public final class TransformAttribute implements Serializable {
  32. private AffineTransform transform;
  33. /**
  34. * Wraps the specified transform. The transform is cloned and a
  35. * reference to the clone is kept. The original transform is unchanged.
  36. * @param transform the specified {@link AffineTransform} to be wrapped
  37. */
  38. public TransformAttribute(AffineTransform transform) {
  39. if (transform == null) {
  40. throw new IllegalArgumentException("transform may not be null");
  41. }
  42. this.transform = new AffineTransform(transform);
  43. }
  44. /**
  45. * Returns a copy of the wrapped transform.
  46. * @return a <code>AffineTransform</code> that is a copy of the wrapped
  47. * transform of this <code>TransformAttribute</code>.
  48. */
  49. public AffineTransform getTransform() {
  50. return new AffineTransform(transform);
  51. }
  52. }