T - the proxy type used by this bean typepublic class BeanModelType<T> extends Object implements ComplexModelType<T>
For internal use only. May be renamed or removed in a future release.
| Modifier | Constructor and Description |
|---|---|
protected |
BeanModelType(Class<T> proxyType,
Map<String,com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty> properties,
boolean allowEmptyProperties)
Creates a new bean model type from the given class and properties.
|
protected |
BeanModelType(Class<T> javaType,
PropertyFilter propertyFilter,
boolean allowEmptyProperties)
Creates a new bean model type with the bean properties of the provided
class that passes the provided property filter.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accepts(Type applicationType)
Checks whether this type can accept application values of the given type.
|
StateNode |
applicationToModel(Object applicationValue,
PropertyFilter filter)
Creates a model value representation of the provided application value.
|
<C> BeanModelType<C> |
cast(Class<C> proxyType)
Checks that this type uses the provided proxy type and returns this type
as a model type with that proxy type.
|
void |
createInitialValue(StateNode node,
String property)
Create initial value for the given
property and set it for the
node. |
void |
createInitialValues(StateNode node)
Creates initial values for the given
node using info from this
model type. |
Map<String,Boolean> |
getClientUpdateAllowedProperties(Set<String> twoWayBindingPaths)
Gets a map whose keys are all properties (including subproperties) that
allowed to be updated from the client-side and values indicate the
property getter presence.
|
protected ClientUpdateMode |
getClientUpdateMode(com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty property)
Gets the client update mode for a property.
|
protected com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty |
getExistingProperty(String propertyName) |
Type |
getJavaType()
Gets the Java
Type that this model encapsulates. |
Stream<String> |
getPropertyNames()
Gets the names of all properties in this bean type.
|
ModelType |
getPropertyType(String propertyName)
Gets the type of the property with the given name.
|
Class<T> |
getProxyType()
Gets the Class that proxies of this bean type should extend.
|
boolean |
hasProperty(String propertyName)
Checks whether this bean type has a property with the given name.
|
void |
importProperties(ElementPropertyMap model,
Object bean,
PropertyFilter propertyFilter)
Imports properties from a bean into a model map based on the properties
in this model type.
|
static boolean |
isBean(Type type)
Checks if the given type can be handled as a bean in a model.
|
T |
modelToApplication(Serializable modelValue)
Creates a representation of the provided model value that is intended for
use in application code.
|
ModelType |
resolveType(String modelPath)
Finds the model type denoted by the given model path.
|
elemental.json.JsonValue |
toJson()
Creates a JSON representation of this model type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSupportedTypesStringprotected BeanModelType(Class<T> proxyType, Map<String,com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty> properties, boolean allowEmptyProperties)
proxyType - the class to use for proxies of this type, not
nullproperties - a map of properties of this type. The contents of the map will
be copied. Not null.allowEmptyProperties - if false then empty properties value is not acceptedIllegalStateException - if allowEmptyProperties is false and
properties is an empty mapprotected BeanModelType(Class<T> javaType, PropertyFilter propertyFilter, boolean allowEmptyProperties)
javaType - the java type of this bean typepropertyFilter - the filter that determines which bean properties to include in
this model typeallowEmptyProperties - if false then empty properties value is not acceptedIllegalStateException - if allowEmptyProperties is false and
propertyFilter resolves empty propertiespublic static boolean isBean(Type type)
type - the type to checktrue if the given type will be handled as a bean,
false if the given type will be handled as a basic
type or is not supportedpublic boolean hasProperty(String propertyName)
propertyName - the property name to checktrue if this model has a property with the given
name; false otherwisepublic ModelType getPropertyType(String propertyName)
propertyName - the name of the property to checkprotected ClientUpdateMode getClientUpdateMode(com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty property)
property - the property descriptor for which to find the client update
modeAllowClientUpdatesprotected com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty getExistingProperty(String propertyName)
public T modelToApplication(Serializable modelValue)
ModelTypemodelToApplication in interface ModelTypemodelValue - the model value to convertpublic Class<T> getProxyType()
nullpublic StateNode applicationToModel(Object applicationValue, PropertyFilter filter)
ModelTypeFor application values that contain properties (i.e. beans), the provided filter is used to determine which properties from the bean should be included in the model representation.
applicationToModel in interface ComplexModelType<T>applicationToModel in interface ModelTypeapplicationValue - the user value to convertfilter - the filter to use to determine which properties to include,
not nullpublic void importProperties(ElementPropertyMap model, Object bean, PropertyFilter propertyFilter)
model - the model map to import values intobean - the bean to get values frompropertyFilter - defines which properties from this model type to importpublic ModelType resolveType(String modelPath)
modelPath - the model path to resolve, not nullnullpublic <C> BeanModelType<C> cast(Class<C> proxyType)
ComplexModelTypecast in interface ComplexModelType<T>C - the proxy typeproxyType - the proxy type to cast topublic Stream<String> getPropertyNames()
nullpublic boolean accepts(Type applicationType)
ModelTypepublic Type getJavaType()
ModelTypeType that this model encapsulates.getJavaType in interface ModelTypepublic elemental.json.JsonValue toJson()
ModelTypepublic void createInitialValue(StateNode node, String property)
ModelTypeproperty and set it for the
node.createInitialValue in interface ModelTypenode - the node where the initial value should be set the
propertyproperty - the property in the node whose initial value needs to
be createdpublic void createInitialValues(StateNode node)
node using info from this
model type.
Initial values are created for all sub-properties as well.
node - the node whose properties need to be populatedpublic Map<String,Boolean> getClientUpdateAllowedProperties(Set<String> twoWayBindingPaths)
twoWayBindingPaths - a set of path names for which two way bindings are defined in
the templateElementPropertyMap.setUpdateFromClientFilter(SerializablePredicate)Copyright © 2025. All rights reserved.