- All Superinterfaces:
AttributeReadOnly,io.github.mmm.marshall.MarshallableObject,io.github.mmm.marshall.Marshaller<Object>,io.github.mmm.marshall.Marshalling<Object>,io.github.mmm.marshall.MarshallingObject,ReadableBean,io.github.mmm.value.ReadablePath,io.github.mmm.marshall.UnmarshallableObject,io.github.mmm.marshall.Unmarshaller<Object>,io.github.mmm.validation.Validatable,io.github.mmm.value.WritablePath
- All Known Subinterfaces:
VirtualBean
- All Known Implementing Classes:
AbstractBean,AbstractVirtualBean,AdvancedBean,Bean,DynamicBean
@AbstractInterface
public interface WritableBean
extends ReadableBean, io.github.mmm.value.WritablePath, io.github.mmm.marshall.MarshallingObject
Writable interface of
ReadableBean.-
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.bean.ReadableBean
PROPERTY_TYPE_ID, PROPERTY_TYPE_NAME, SUFFIX_PROPERTY -
Method Summary
Modifier and TypeMethodDescription<P extends WritableProperty<?>>
PaddProperty(P property) Adds the givenWritablePropertyto this bean.default <V> WritableProperty<V>createProperty(String name, Class<V> valueClass) <V> WritableProperty<V>createProperty(String name, Class<V> valueClass, Type valueType) static <B extends WritableBean>
Bfrom(WritableProperty<?> property) default <V> WritableProperty<V>getOrCreateProperty(String name, Class<V> valueClass) default <V> WritableProperty<V>getOrCreateProperty(String name, Class<V> valueClass, Type valueType) Collection<? extends WritableProperty<?>>getProperty(String name) default WritableProperty<?>getRequiredProperty(String name) voidpathSegment(String pathSegment) Used to set an alias as described inpathSegment().default voidread(io.github.mmm.marshall.StructuredReader reader) default voiddefault <V> void/** Sets the value of theexisting or newly created propertywith the givennameto the givenvalue.default <V> void/** Sets the value of theexisting or newly created propertywith the givennameto the givenvalue.default voidsetDynamic(String name, Object value) Methods inherited from interface io.github.mmm.property.AttributeReadOnly
isReadOnlyMethods inherited from interface io.github.mmm.marshall.MarshallableObject
write, writeObjectMethods inherited from interface io.github.mmm.bean.ReadableBean
copy, doEquals, doToString, get, getAliases, getPropertyCount, getType, isDynamic, isEqualTo, isPolymorphic, isPrototype, mapPropertyIds, newInstance, toString, validateMethods inherited from interface io.github.mmm.value.ReadablePath
parentPath, path, path, pathMethods inherited from interface io.github.mmm.marshall.UnmarshallableObject
readObjectMethods inherited from interface io.github.mmm.validation.Validatable
validateOrThrowMethods inherited from interface io.github.mmm.value.WritablePath
parentPath
-
Method Details
-
getProperty
- Specified by:
getPropertyin interfaceReadableBean- Parameters:
name- thenameof the requested property or a potentialaliasof the property.- Returns:
- the requested
WritablePropertyornullif no such property exists. - See Also:
-
getProperties
Collection<? extends WritableProperty<?>> getProperties()- Specified by:
getPropertiesin interfaceReadableBean- Returns:
- a
Collectionwith allpropertiesof this bean.
-
getRequiredProperty
- Specified by:
getRequiredPropertyin interfaceReadableBean- Parameters:
name- thenameof the requested property.- Returns:
- the requested
property.
-
set
- Parameters:
name- thenameof the property.value- newvalueof the specified property.
-
setDynamic
Sets the value of thepropertywith the givennameto the givenvalue. If no suchpropertyexists, it will becreateddynamicallyif the given value is notnull.- Parameters:
name- thenameof the property.value- newvalueof the specified property.
-
set
/** Sets the value of theexisting or newly created propertywith the givennameto the givenvalue.- Type Parameters:
V- the generic type of thevalue class.- Parameters:
name- theproperty name.value- newvalueof the specified property.valueClass- thevalue class.- See Also:
-
set
/** Sets the value of theexisting or newly created propertywith the givennameto the givenvalue.- Type Parameters:
V- the generic type of thevalue class.- Parameters:
name- theproperty name.value- newvalueof the specified property.valueClass- thevalue class.valueType- theTypereflecting theproperty value.- See Also:
-
addProperty
Adds the givenWritablePropertyto this bean.- Type Parameters:
P- type of theWritablePropertyto add.- Parameters:
property- theWritablePropertyto add.- Returns:
- the given
property. - Throws:
IllegalStateException- if thisWritableBeanisread-onlyor notdynamic.
-
createProperty
- Type Parameters:
V- the generic type of thevalue class.- Parameters:
name- theproperty name.valueClass- thevalue class.- Returns:
- the newly created and added property.
- Throws:
IllegalStateException- if thisWritableBeanalready has such property, isread-only, or notdynamic.
-
createProperty
- Type Parameters:
V- the generic type of thevalue class.- Parameters:
name- theproperty name.valueClass- thevalue class.valueType- theTypereflecting theproperty value.- Returns:
- the newly created and added property.
- Throws:
IllegalStateException- if thisWritableBeanalready has such property, isread-only, or notdynamic.
-
getOrCreateProperty
- Type Parameters:
V- the generic type of theproperty value.- Parameters:
name- theproperty name.valueClass- thevalue classof the requested property.- Returns:
- the requested property. Will be created if it does not already
exist. - Throws:
IllegalArgumentException- if the requested property already exists but has an incompatiblevalue class.IllegalStateException- if the requested property does not exist but thisWritableBeanisread-only, or notdynamic.
-
getOrCreateProperty
default <V> WritableProperty<V> getOrCreateProperty(String name, Class<V> valueClass, Type valueType) - Type Parameters:
V- the generic type of theproperty value.- Parameters:
name- theproperty name.valueClass- theClassreflecting theproperty value.valueType- theTypereflecting theproperty value.- Returns:
- the requested property. Will be created if it does not already
exist. - Throws:
IllegalArgumentException- if the requested property already exists but has an incompatiblevalue class.IllegalStateException- if the requested property does not exist but thisWritableBeanisread-only, or notdynamic.
-
read
default void read(io.github.mmm.marshall.StructuredReader reader) - Specified by:
readin interfaceio.github.mmm.marshall.UnmarshallableObject
-
pathSegment
String pathSegment()- Specified by:
pathSegmentin interfaceio.github.mmm.value.ReadablePath- Returns:
- the optional alias of this bean. It will be appended as prefix to the
ReadablePath.path()of allproperties. This is useful for API to build queries. So e.g. set to "alias" and your contained property will have the path "alias.MyProperty".
-
pathSegment
Used to set an alias as described inpathSegment(). ATTENTION: End users should never use this method directly but use designated methods such asas(String alias)provided by according SQL clauses.- Specified by:
pathSegmentin interfaceio.github.mmm.value.WritablePath
-
from
- Type Parameters:
B- type of theWritableBeanowning theproperty.- Parameters:
property- theWritablePropertyfor which the owningWritableBeanis requested.- Returns:
- the
WritableBeanowning the givenproperty. Will benullif theWritablePropertyis manually created from outside a bean.
-