-
- All Superinterfaces:
io.github.mmm.property.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.marshall.MarshallingObject
Writable interface ofReadableBean.
-
-
Field Summary
-
Fields inherited from interface io.github.mmm.bean.ReadableBean
PROPERTY_TYPE, SUFFIX_PROPERTY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <P extends io.github.mmm.property.WritableProperty<?>>
PaddProperty(P property)Adds the givenWritablePropertyto this bean.default <V> io.github.mmm.property.WritableProperty<V>createProperty(String name, Class<V> valueClass)<V> io.github.mmm.property.WritableProperty<V>createProperty(String name, Class<V> valueClass, Type valueType)default <V> io.github.mmm.property.WritableProperty<V>getOrCreateProperty(String name, Class<V> valueClass)default <V> io.github.mmm.property.WritableProperty<V>getOrCreateProperty(String name, Class<V> valueClass, Type valueType)Collection<? extends io.github.mmm.property.WritableProperty<?>>getProperties()io.github.mmm.property.WritableProperty<?>getProperty(String name)default io.github.mmm.property.WritableProperty<?>getRequiredProperty(String name)default voidread(io.github.mmm.marshall.StructuredReader reader)default voidset(String name, Object value)Sets the value of therequired propertywith the givennameto the given value.default <V> voidset(String name, V value, Class<V> valueClass)/** Sets the value of theexisting or newly created propertywith the givennameto the given value.default <V> voidset(String name, V value, Class<V> valueClass, Type valueType)/** Sets the value of theexisting or newly created propertywith the givennameto the given value.-
Methods inherited from interface io.github.mmm.bean.ReadableBean
copy, get, getPropertyCount, getPropertyNameForAlias, getType, isDynamic, isEqualTo, isPolymorphic, isPrototype, newInstance, path, validate, write
-
-
-
-
Method Detail
-
getProperty
io.github.mmm.property.WritableProperty<?> getProperty(String name)
- 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:
addProperty(WritableProperty),getOrCreateProperty(String, Class)
-
getProperties
Collection<? extends io.github.mmm.property.WritableProperty<?>> getProperties()
- Specified by:
getPropertiesin interfaceReadableBean- Returns:
- a
Collectionwith allpropertiesof this bean.
-
getRequiredProperty
default io.github.mmm.property.WritableProperty<?> getRequiredProperty(String name)
- Specified by:
getRequiredPropertyin interfaceReadableBean- Parameters:
name- thenameof the requested property.- Returns:
- the requested
property.
-
set
default void set(String name, Object value)
Sets the value of therequired propertywith the givennameto the given value.- Parameters:
name- thenameof the property.value- newvalueof the specified property.
-
set
default <V> void set(String name, V value, Class<V> valueClass)
/** Sets the value of theexisting or newly created propertywith the givennameto the given value.- Type Parameters:
V- the generic type of thevalue class.- Parameters:
name- theproperty name.value- newvalueof the specified property.valueClass- thevalue class.- See Also:
set(String, Object)
-
set
default <V> void set(String name, V value, Class<V> valueClass, Type valueType)
/** Sets the value of theexisting or newly created propertywith the givennameto the given value.- 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:
set(String, Object)
-
addProperty
<P extends io.github.mmm.property.WritableProperty<?>> P addProperty(P property)
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
default <V> io.github.mmm.property.WritableProperty<V> createProperty(String name, Class<V> valueClass)
- 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
<V> io.github.mmm.property.WritableProperty<V> createProperty(String name, Class<V> valueClass, Type valueType)
- 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
default <V> io.github.mmm.property.WritableProperty<V> getOrCreateProperty(String name, Class<V> valueClass)
- 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> io.github.mmm.property.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
-
-