Class UniqueNameGenerationHelper.NameGenerationOptions
java.lang.Object
de.xima.fc.copy.UniqueNameGenerationHelper.NameGenerationOptions
- Enclosing class:
UniqueNameGenerationHelper
Deprecated.
POJO for customizing the options
- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptioncopySuffix(String copySuffix) Deprecated.Setup the interpolator so that the generated names are likeMyEntity_Copy_4copyWithSpace(String copyName) Deprecated.Setup the interpolator so that the generated names are likeMyEntity (Copy 4)create()Deprecated.Deprecated.intDeprecated.intDeprecated.Deprecated.intDeprecated.Deprecated.interpolator(BiFunction<String, Integer, String> interpolator) Deprecated.maxAttempts(int maxAttempts) Deprecated.maxLength(int maxLength) Deprecated.Deprecated.When generating the new name, replaces all matches for the given regex with the given replacement.sanitizer(UnaryOperator<String> sanitizer) Deprecated.startIndex(int startIndex) Deprecated.validityCheck(Predicate<String> validityCheck) Deprecated.
-
Method Details
-
getMaxLength
public int getMaxLength()Deprecated. -
getStartIndex
public int getStartIndex()Deprecated. -
getValidityCheck
-
getSanitizer
Deprecated. -
getInterpolator
Deprecated. -
getMaxAttempts
public int getMaxAttempts()Deprecated. -
maxLength
Deprecated.- Parameters:
maxLength- Maximum length that is allowed for the name. The generated name is truncated to fit this length.- Returns:
- This for chaining.
-
maxAttempts
Deprecated.- Parameters:
maxAttempts- Maximum number of generated names that are tried (againstgetValidityCheck()).- Returns:
- This for chaining.
-
startIndex
Deprecated.- Parameters:
startIndex- The initial index used for generating new names. Defaults to1, so the first generated name ends onCopy_1.- Returns:
- This for chaining.
-
validityCheck
public UniqueNameGenerationHelper.NameGenerationOptions validityCheck(Predicate<String> validityCheck) Deprecated.- Parameters:
validityCheck- A predicate that checks whether a given generated name is allowed, eg. whether a project with that name exists already. It must returntrueif the given new name is valid,falseotherwise.- Returns:
- This for chaining.
-
sanitizer
Deprecated.- Parameters:
sanitizer- An operator that takes a generated name and sanitizes it, eg. replaces characters that are not allowed for that name, such as whitespaces with underscores.- Returns:
- This for chaining.
-
interpolator
public UniqueNameGenerationHelper.NameGenerationOptions interpolator(BiFunction<String, Integer, String> interpolator) Deprecated.- Parameters:
interpolator- Function that receives the name and the current index and creates the derived name with the index, egmyfile (copy 2).
-
copySuffix
Deprecated.Setup the interpolator so that the generated names are likeMyEntity_Copy_4- Parameters:
copySuffix- Suffix added to the original name, eg.Copy.- Returns:
- This for chaining.
-
copyWithSpace
Deprecated.Setup the interpolator so that the generated names are likeMyEntity (Copy 4)- Parameters:
copyName- Localized name for 'Copy'.- Returns:
- This for chaining.
-
replace
public UniqueNameGenerationHelper.NameGenerationOptions replace(String disallowedCharactersRegex, char replacementCharacter) Deprecated.When generating the new name, replaces all matches for the given regex with the given replacement. Useful eg. for replacing whitespaces with underscores.- Parameters:
disallowedCharactersRegex- Characters that are not allowed in the name and should be replaced.replacementCharacter- Character that replaces the disallowed characters.- Returns:
- This for chaining.
-
create
Deprecated.
-
UniqueNameGenerationHelper.NameGenerationOptionsinstead.