org.apache.fop.render.pdf.pdfbox

## Class UniqueName

- java.lang.Object
- - org.apache.fop.render.pdf.pdfbox.UniqueName

-     public class UniqueName
      extends java.lang.Object

  This class provides collision-avoidance for names within a collection. That is, if a submitted name collides with a name in the collection, an alternative is provided. The alternative may or may not be in the collection.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `UniqueName(java.lang.String key, org.apache.pdfbox.cos.COSDictionary sourcePageResources, java.util.List<org.apache.pdfbox.cos.COSName> patternNames, boolean disable, java.awt.Rectangle destRect)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.lang.String` | `getName(org.apache.pdfbox.cos.COSName cn)` Provides a de-collisioned name.
    `protected void` | `writeName(java.lang.StringBuilder sb, org.apache.pdfbox.cos.COSName cn)` Writes a name into a StringBuilder, appending a suffix if the name exists in this object's collection.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### UniqueName

          public UniqueName(java.lang.String key,
                            org.apache.pdfbox.cos.COSDictionary sourcePageResources,
                            java.util.List<org.apache.pdfbox.cos.COSName> patternNames,
                            boolean disable,
                            java.awt.Rectangle destRect)

  - ### Method Detail

    - #### getName

          protected java.lang.String getName(org.apache.pdfbox.cos.COSName cn)

      Provides a de-collisioned name.
      Parameters:
        `cn` - Submitted name.
      Returns:
        The submitted name if it is not already in this object's collection or an alternative it is. It is possible that the alternative is also in the collection.

    - #### writeName

          protected void writeName(java.lang.StringBuilder sb,
                                   org.apache.pdfbox.cos.COSName cn)
                            throws java.io.IOException

      Writes a name into a StringBuilder, appending a suffix if the name exists in this object's collection.
      Parameters:
        `sb` - The StringBuilder.
        `cn` - The COSName.
      Throws:
        `java.io.IOException` - On IO exception.

Copyright 2007-2025 The Apache Software Foundation. All Rights Reserved.