java.lang.Object
io.github.mmm.event.AbstractEventSource<ObservableEvent<String>,ObservableEventListener<? super String>>
io.github.mmm.event.AbstractEventSender<ObservableEvent<String>,ObservableEventListener<? super String>>
io.github.mmm.value.observable.AbstractObservableValue<String>
io.github.mmm.value.observable.AbstractWritableObservableValue<String>
io.github.mmm.property.Property<String>
io.github.mmm.property.object.SimpleProperty<String>
io.github.mmm.property.string.StringProperty
io.github.mmm.property.string.StringCollectionProperty
- All Implemented Interfaces:
io.github.mmm.event.EventSource<ObservableEvent<String>,,ObservableEventListener<? super String>> io.github.mmm.marshall.MarshallableObject,io.github.mmm.marshall.Marshaller<Object>,io.github.mmm.marshall.Marshalling<Object>,io.github.mmm.marshall.MarshallingObject,io.github.mmm.marshall.UnmarshallableObject,io.github.mmm.marshall.Unmarshaller<Object>,AttributeReadOnly,io.github.mmm.property.comparable.ComparablePredicateSupport<String>,io.github.mmm.property.comparable.ReadableComparableProperty<String>,io.github.mmm.property.comparable.WritableComparableProperty<String>,ReadableSimpleProperty<String>,WritableSimpleProperty<String>,ReadableProperty<String>,ReadableStringProperty,WritableStringProperty,WritableProperty<String>,Validatable,io.github.mmm.value.CriteriaObject<String>,ComparableExpression<String>,Expression<String>,ObservableSimpleValue<String>,ReadableObjectValue<String>,ReadableSimpleObjectValue<String>,ReadableSimpleValue<String>,WritableSimpleValue<String>,ObservableValue<String>,ObservableStringValue,ReadableStringValue,StringExpression,WritableStringValue,WritableObservableValue<String>,io.github.mmm.value.PropertyPath<String>,io.github.mmm.value.ReadablePath,io.github.mmm.value.ReadableValue<String>,io.github.mmm.value.WritableValue<String>,Cloneable,Comparable<ReadableProperty<?>>,Iterable<String>,Supplier<String>
- Direct Known Subclasses:
StringListProperty,StringSetProperty
This is an extension of
Please note that
StringProperty that stores a Collection of Strings as a simple
String in a CSV like format. Since it needs a separator character that shall not occur inside the contained
String elements, it is only suitable for limited use-cases such as representing a set of tags or synonyms.
For a generic collection of arbitrary Strings (or other elements) please consider using
CollectionProperty. However, in cases where this implementation
is applicable, it can be a pragmatic simplification compared to relational associations.Please note that
null elements will be silently ignored by operations such as add or
remove while the empty String is not.- Since:
- 1.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.mmm.value.ReadablePath
io.github.mmm.value.ReadablePath.PathBuilder -
Field Summary
Fields inherited from interface io.github.mmm.property.WritableProperty
NO_PROPERTIES -
Constructor Summary
ConstructorsConstructorDescriptionThe constructor.StringCollectionProperty(String name, PropertyMetadata<String> metadata) The constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected <C extends Collection<String>>
Ccollect(C collection) booleanprotected Collection<String> protected Stringprotected booleanDetermines if the elements shall be enclosed with the separator (e.g.iterator()protected voidreadValue(io.github.mmm.marshall.StructuredReader reader) booleanvoidset(Collection<String> collection) voidvoidprotected voidsetWithChange(String oldValue, String value) voidwrite(io.github.mmm.marshall.StructuredWriter writer) Methods inherited from class io.github.mmm.property.string.StringProperty
doGet, doSetMethods inherited from class io.github.mmm.property.Property
clearValidationResult, clone, compareTo, copy, createReadOnlyExpression, doValidate, doValidate, equals, get, getMetadata, getName, getReadOnly, hashCode, isReadOnly, isSensitive, isValid, isValueMutable, makeReadOnly, read, readObject, requireWritable, toString, validate, writeObjectMethods inherited from class io.github.mmm.value.observable.AbstractWritableObservableValue
bindInternal, bindOneWay, bindTwoWay, isBoundOneWay, isValueEqual, set, unbindOneWay, unbindTwoWayMethods inherited from class io.github.mmm.value.observable.AbstractObservableValue
doAddListener, fireChange, fireEvent, fireEvent, fireEventFor, fireEventFor, fireEventWithOldValue, hasChangeAwareListeners, invalidate, removeListener, toStringMethods inherited from class io.github.mmm.event.AbstractEventSender
getEventAdapter, hasListenersMethods inherited from class io.github.mmm.event.AbstractEventSource
addListenerMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.mmm.property.AttributeReadOnly
isReadOnlyMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface io.github.mmm.value.observable.comparable.ComparableExpression
greaterThan, greaterThan, greaterThanOrEqualTo, greaterThanOrEqualTo, lessThan, lessThan, lessThanOrEqualTo, lessThanOrEqualToMethods inherited from interface io.github.mmm.property.comparable.ComparablePredicateSupport
ge, ge, gt, gt, le, le, lt, ltMethods inherited from interface io.github.mmm.event.EventSource
addListener, addListener, addWeakListener, removeListenerMethods inherited from interface io.github.mmm.value.observable.Expression
asString, dispose, isEqualTo, isEqualTo, isNotEqualTo, isNotEqualTo, isNotNull, isNullMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface io.github.mmm.marshall.MarshallableObject
writeObjectMethods inherited from interface io.github.mmm.value.observable.ObservableValue
toStringMethods inherited from interface io.github.mmm.value.PropertyPath
pathSegmentMethods inherited from interface io.github.mmm.property.comparable.ReadableComparableProperty
asc, descMethods inherited from interface io.github.mmm.value.observable.object.ReadableObjectValue
getValueMethods inherited from interface io.github.mmm.value.ReadablePath
path, path, pathMethods inherited from interface io.github.mmm.property.ReadableProperty
count, eq, eq, getMetadata, getName, getQualifiedName, getQualifiedName, getTypeMapper, isEqual, isMandatory, isTransient, isValid, neq, neq, parentPathMethods inherited from interface io.github.mmm.property.object.ReadableSimpleProperty
in, in, notIn, notInMethods inherited from interface io.github.mmm.property.string.ReadableStringProperty
inverseLike, inverseNotLike, like, notLikeMethods inherited from interface io.github.mmm.value.observable.string.ReadableStringValue
getAsString, getFallbackSafeValue, getValueClass, parseMethods inherited from interface io.github.mmm.value.ReadableValue
get, getSafeMethods inherited from interface io.github.mmm.value.observable.string.StringExpression
concat, isEmpty, isEqualToIgnoreCase, isEqualToIgnoreCase, isNotEmpty, isNotEqualToIgnoreCase, isNotEqualToIgnoreCase, lengthMethods inherited from interface io.github.mmm.marshall.UnmarshallableObject
read, readObjectMethods inherited from interface io.github.mmm.validation.Validatable
validate, validateOrThrowMethods inherited from interface io.github.mmm.value.observable.WritableObservableValue
bindOneWay, bindTwoWay, isBoundOneWay, unbindOneWay, unbindTwoWayMethods inherited from interface io.github.mmm.property.WritableProperty
copy, copyValue, getReadOnlyMethods inherited from interface io.github.mmm.value.observable.string.WritableStringValue
setAsString, setValueMethods inherited from interface io.github.mmm.value.WritableValue
set
-
Constructor Details
-
Method Details
-
getCollection
- Returns:
- the potential
Collectionto redundantly manage the elements efficiently ornullif all information is only maintained in theStringvalue. Please note thatbindingmay cause undesired effects if backed by aCollection.
-
getSeparator
- Returns:
- the separator character (e.g. "|", ";", "," - may also be something exotic like "$invalid input: '&'%" to avoid collision with elements).
-
isEncloseWithSeparator
protected boolean isEncloseWithSeparator()Determines if the elements shall be enclosed with the separator (e.g. "|one|two|three|") or not (e.g. "one|two|three"). Enclosing can be used as a pragmatic approach to store lists or sets in a database while still being able to search with SQL usingcontains(e.g.WHERE x.tags CONTAINS '|one|'). Also enclosing is increasing the efficiency ofaddandremoveoperations. Therefore, it is highly recommended to stick with the default (truefor activated enclosing). To display thevalueto end-users you can usegetCsv(String, boolean). -
setWithChange
- Overrides:
setWithChangein classProperty<String>
-
contains
- Parameters:
element- the element to check.- Returns:
trueif the givenelementis contained in this collection ofStrings.- See Also:
-
add
-
remove
- Parameters:
element- the element to remove from thisStringcollection.- Returns:
trueif the given element was previously present and is now removed so the value actually has changed,falseotherwise (if not present and no change).- See Also:
-
set
- Parameters:
collection- theCollectionof elements to set as separatedstring value.
-
getCsv
- Parameters:
separator- the customseparatorto use (e.g. ";" for CSV).enclose- the customenclose with separator flag.- Returns:
- the
valueas CSV with the given parameters.
-
setCsv
- Parameters:
csv- the newvaluewith elements separated by the givenseparator.separator- the customseparatorto use (e.g. ";" for CSV).enclose- the customenclose with separator flag.
-
setCsv
- Parameters:
csv- the newvaluewith elements separated by the givenseparator.separator- the customseparatorto use (e.g. ";" for CSV).enclose- the customenclose with separator flag.trim-trueif the elements from the givencsvshould betrimmed,falseotherwise.
-
collect
- Type Parameters:
C- type of theCollection.- Parameters:
collection- theCollectionwhere toaddthe elements from this property.- Returns:
- the given
Collection.
-
readValue
protected void readValue(io.github.mmm.marshall.StructuredReader reader) Description copied from class:Property- Overrides:
readValuein classSimpleProperty<String>- Parameters:
reader- theStructuredReaderto read the value from.- See Also:
-
write
public void write(io.github.mmm.marshall.StructuredWriter writer) - Specified by:
writein interfaceio.github.mmm.marshall.MarshallableObject- Overrides:
writein classSimpleProperty<String>
-
iterator
-