Class PolyString
java.lang.Object
com.evolveum.midpoint.prism.polystring.PolyString
- All Implemented Interfaces:
- Matchable<PolyString>,- Recomputable,- Structured,- DebugDumpable,- ShortDumpable,- Serializable,- Comparable<Object>
public class PolyString
extends Object
implements Matchable<PolyString>, Recomputable, Structured, DebugDumpable, ShortDumpable, Serializable, Comparable<Object>
Polymorphic string. String that may have more than one representation at
 the same time. The primary representation is the original version that is
 composed of the full Unicode character set. The other versions may be
 normalized to trim it, normalize character case, normalize spaces,
 remove national characters or even transliterate the string.
 PolyString is (almost) immutable. The original value is immutable, but the
 other normalized values can be changed. However the only way to change them
 is to recompute them from the original value.
- Author:
- Radovan Semancik
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final ItemNamestatic final Stringstatic final ItemNamestatic final ItemNamestatic final ItemNamestatic final StringFields inherited from interface com.evolveum.midpoint.util.DebugDumpableINDENT_STRING
- 
Constructor SummaryConstructorsConstructorDescriptionPolyString(String orig) PolyString(String orig, String norm) PolyString(String orig, String norm, PolyStringTranslationType translation) PolyString(String orig, String norm, PolyStringTranslationType translation, Map<String, String> lang) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidintcopy()debugDump(int indent) booleanHelper function that checks whether this original string ends with the specified value.booleanbooleanstatic PolyStringReturns poly-string for the provided `orig` value with `norm` recomputed with default normalizer.getAt(int index) getLang()getNorm()static StringReturns norm value or null for the nullable input polystring.static StringReturns norm value or null for the nullable input polystring.getOrig()static StringReturns orig value or null for the nullable input polystring.static StringReturns orig value or null for the nullable input polystring.inthashCode()booleanbooleanisEmpty()booleanisNull()booleanisSimple()Returns true if the PolyString form contains only simple string.intlength()booleanmatch(PolyString other) booleanRecomputes normalized value with default normalizer and returns modified `this`.voidrecompute(PolyStringNormalizer normalizer) voidsetComputedOrig(String computedOrig) Used to set computed values of orig, e.g. in cases of translation.voidDo NOT rely on this method too much.voidsetTranslation(PolyStringTranslationType translation) Do NOT rely on this method too much.voidShow the content of the object intended for diagnostics.booleanstartsWith(String value) Helper function that checks whether this original string begins with the specified value.substring(int from, int to) static PolyStringtoPolyString(PolyStringType value) static PolyStringTypetoPolyStringType(PolyString value) toString()trim()Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.evolveum.midpoint.util.DebugDumpabledebugDump, debugDumpLazily, debugDumpLazilyMethods inherited from interface com.evolveum.midpoint.util.ShortDumpableshortDump, shortDumpLazily
- 
Field Details- 
F_ORIG
- 
F_NORM
- 
F_TRANSLATION
- 
F_TRANSLATION_LOCAL_PART
- 
F_LANG
- 
F_LANG_LOCAL_PART
 
- 
- 
Constructor Details- 
PolyString
- 
PolyString
- 
PolyString
- 
PolyString
 
- 
- 
Method Details- 
getOrig
- 
setComputedOrigUsed to set computed values of orig, e.g. in cases of translation. Not very clean.
- 
getNorm
- 
getTranslation
- 
getLang
- 
setTranslationDo NOT rely on this method too much. It may disappear later, e.g. when we align PolyString and PolyString type and make PolyString really immutable.
- 
setLangDo NOT rely on this method too much. It may disappear later, e.g. when we align PolyString and PolyString type and make PolyString really immutable.
- 
isEmptypublic boolean isEmpty()
- 
isNullpublic boolean isNull()
- 
recompute
- 
recomputeRecomputes normalized value with default normalizer and returns modified `this`.
- 
isComputedpublic boolean isComputed()
- 
resolve- Specified by:
- resolvein interface- Structured
 
- 
plus
- 
getAt
- 
compareTo- Specified by:
- compareToin interface- Comparable<Object>
 
- 
lengthpublic int length()
- 
trim
- 
substring
- 
startsWithHelper function that checks whether this original string begins with the specified value.- Parameters:
- value- the value
- Returns:
- the string
 
- 
endsWithHelper function that checks whether this original string ends with the specified value.- Parameters:
- value- the value
- Returns:
- the string
 
- 
hashCodepublic int hashCode()
- 
equals
- 
equalsOriginalValue- Specified by:
- equalsOriginalValuein interface- Recomputable
 
- 
toString
- 
debugDump- Specified by:
- debugDumpin interface- DebugDumpable
 
- 
shortDumpDescription copied from interface:ShortDumpableShow the content of the object intended for diagnostics. This method is supposed to append a compact, human-readable output in a single line. Unlike toString() method, there is no requirement to identify the actual class or type of the object. It is assumed that the class/type will be obvious from the context in which the output is used.- Specified by:
- shortDumpin interface- ShortDumpable
- Parameters:
- sb- StringBuilder to which to a compact one-line content of the object intended for diagnostics by system administrator should be appended.
 
- 
getOrigReturns orig value or null for the nullable input polystring.
- 
getOrigReturns orig value or null for the nullable input polystring.
- 
getNormReturns norm value or null for the nullable input polystring.
- 
getNormReturns norm value or null for the nullable input polystring.
- 
match- Specified by:
- matchin interface- Matchable<PolyString>
 
- 
matches- Specified by:
- matchesin interface- Matchable<PolyString>
 
- 
isSimplepublic boolean isSimple()Returns true if the PolyString form contains only simple string. I.e. returns true if the polystring can be serialized in a simplified form of a single string. Returns true in case that there are language mutations, translation, etc.
- 
checkConsistencepublic void checkConsistence()- Specified by:
- checkConsistencein interface- Recomputable
 
- 
toPolyString
- 
toPolyStringType
- 
fromOrigReturns poly-string for the provided `orig` value with `norm` recomputed with default normalizer. If, for whatever reason, poly-string with only `orig` is needed, use the constructor with `orig` parameter. TODO: Recompute added in 4.7, check usages, remove useless recomputes outside and eventually remove this TODO.
- 
copy
 
-