public class IdGenerator extends Object
Constructor and Description |
---|
IdGenerator()
Create an empty id generator.
|
IdGenerator(IdGenerator idGenerator)
Clone an id generator.
|
Modifier and Type | Method and Description |
---|---|
String |
generateUniqueId(String text)
Same as
generateUniqueId(String, String) but with a fixed prefix of "I". |
String |
generateUniqueId(String prefix,
String text)
Generate a unique id attribute using the passed text as the seed value.
|
void |
remove(String id)
Remove the saved previously generated id to make it available again.
|
void |
reset()
Reset the known generated ids.
|
public IdGenerator()
public IdGenerator(IdGenerator idGenerator)
idGenerator
- the id generator to copypublic String generateUniqueId(String text)
generateUniqueId(String, String)
but with a fixed prefix of "I".text
- the text used to generate the unique idpublic String generateUniqueId(String prefix, String text)
When defining fragment identifiers to be backward-compatible, only strings matching the pattern
[A-Za-z][A-Za-z0-9:_.-]* should be used.
prefix
- the prefix of the identifier. Has to match [a-zA-Z].text
- the text used to generate the unique idpublic void remove(String id)
id
- the id to remove from the generated ids.public void reset()
Copyright © 2004–2021 XWiki. All rights reserved.