com.vaadin.flow.templatemodel.
Class BeanModelType<T>
- java.lang.Object
-
- com.vaadin.flow.templatemodel.BeanModelType<T>
-
Type Parameters:
T
- the proxy type used by this bean typeAll Implemented Interfaces:
Direct Known Subclasses:
@Deprecated public class BeanModelType<T> extends Object implements ComplexModelType<T>
Deprecated.Template model and model types are not supported for lit template, but you can use@Id
mapping and the component API or the element API with property synchronization instead. Polymer template support is deprecated - we recommend you to useLitTemplate
instead. Read more details from the Vaadin blog.A model type corresponding to a Java bean type.
For internal use only. May be renamed or removed in a future release.
Since:
1.0
Author:
Vaadin Ltd
See Also:
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BeanModelType(Class<T> javaType, PropertyFilter propertyFilter, boolean allowEmptyProperties)
Deprecated.
Creates a new bean model type with the bean properties of the provided class that passes the provided property filter.
protected
BeanModelType(Class<T> proxyType, Map<String,com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty> properties, boolean allowEmptyProperties)
Deprecated.
Creates a new bean model type from the given class and properties.
-
Method Summary
All Methods Modifier and Type Method Description boolean
accepts(Type applicationType)
Deprecated.
Checks whether this type can accept application values of the given type.
StateNode
applicationToModel(Object applicationValue, PropertyFilter filter)
Deprecated.
Creates a model value representation of the provided application value.
<C> BeanModelType<C>
cast(Class<C> proxyType)
Deprecated.
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)
Deprecated.
Create initial value for the given
property
and set it for thenode
.void
createInitialValues(StateNode node)
Deprecated.
Creates initial values for the given
node
using info from this model type.Map<String,Boolean>
getClientUpdateAllowedProperties(Set<String> twoWayBindingPaths)
Deprecated.
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)
Deprecated.
Gets the client update mode for a property.
protected com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty
getExistingProperty(String propertyName)
Deprecated.
Type
getJavaType()
Deprecated.
Gets the Java
Type
that this model encapsulates.Stream<String>
getPropertyNames()
Deprecated.
Gets the names of all properties in this bean type.
ModelType
getPropertyType(String propertyName)
Deprecated.
Gets the type of the property with the given name.
Class<T>
getProxyType()
Deprecated.
Gets the Class that proxies of this bean type should extend.
boolean
hasProperty(String propertyName)
Deprecated.
Checks whether this bean type has a property with the given name.
void
importProperties(ElementPropertyMap model, Object bean, PropertyFilter propertyFilter)
Deprecated.
Imports properties from a bean into a model map based on the properties in this model type.
static boolean
isBean(Type type)
Deprecated.
Checks if the given type can be handled as a bean in a model.
T
modelToApplication(Serializable modelValue)
Deprecated.
Creates a representation of the provided model value that is intended for use in application code.
ModelType
resolveType(String modelPath)
Deprecated.
Finds the model type denoted by the given model path.
elemental.json.JsonValue
toJson()
Deprecated.
Creates a JSON representation of this model type.
-
-
-
Constructor Detail
-
BeanModelType
protected BeanModelType(Class<T> proxyType, Map<String,com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty> properties, boolean allowEmptyProperties)
Deprecated.Creates a new bean model type from the given class and properties.
Parameters:
proxyType
- the class to use for proxies of this type, notnull
properties
- a map of properties of this type. The contents of the map will be copied. Notnull
.allowEmptyProperties
- iffalse
then empty properties value is not acceptedThrows:
IllegalStateException
- ifallowEmptyProperties
isfalse
andproperties
is an empty map
-
BeanModelType
protected BeanModelType(Class<T> javaType, PropertyFilter propertyFilter, boolean allowEmptyProperties)
Deprecated.Creates a new bean model type with the bean properties of the provided class that passes the provided property filter.
Parameters:
javaType
- the java type of this bean typepropertyFilter
- the filter that determines which bean properties to include in this model typeallowEmptyProperties
- iffalse
then empty properties value is not acceptedThrows:
IllegalStateException
- ifallowEmptyProperties
isfalse
andpropertyFilter
resolves empty properties
-
-
Method Detail
-
isBean
public static boolean isBean(Type type)
Deprecated.Checks if the given type can be handled as a bean in a model.
Parameters:
type
- the type to checkReturns:
true
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 supported
-
hasProperty
public boolean hasProperty(String propertyName)
Deprecated.Checks whether this bean type has a property with the given name.
Parameters:
propertyName
- the property name to checkReturns:
true
if this model has a property with the given name;false
otherwise
-
getPropertyType
public ModelType getPropertyType(String propertyName)
Deprecated.Gets the type of the property with the given name.
Parameters:
propertyName
- the name of the property to checkReturns:
the model type
-
getClientUpdateMode
protected ClientUpdateMode getClientUpdateMode(com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty property)
Deprecated.Gets the client update mode for a property.
Parameters:
property
- the property descriptor for which to find the client update modeReturns:
the client update mode, or IF_TWO_WAY_BINDING if no mode has been explicitly configured
See Also:
-
getExistingProperty
protected com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty getExistingProperty(String propertyName)
Deprecated.
-
modelToApplication
public T modelToApplication(Serializable modelValue)
Deprecated.Description copied from interface:
ModelType
Creates a representation of the provided model value that is intended for use in application code. For mutable values, this is typically a proxy that is directly connected to the underlying model value.
Specified by:
modelToApplication
in interfaceModelType
Parameters:
modelValue
- the model value to convertReturns:
a user-friendly representation of the provided model value
-
getProxyType
public Class<T> getProxyType()
Deprecated.Gets the Class that proxies of this bean type should extend.
Returns:
the proxy type to use, not
null
-
applicationToModel
public StateNode applicationToModel(Object applicationValue, PropertyFilter filter)
Deprecated.Description copied from interface:
ModelType
Creates a model value representation of the provided application value.
For 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.
Specified by:
applicationToModel
in interfaceComplexModelType<T>
Specified by:
applicationToModel
in interfaceModelType
Parameters:
applicationValue
- the user value to convertfilter
- the filter to use to determine which properties to include, notnull
Returns:
a model value representation of the provided user value.
-
importProperties
public void importProperties(ElementPropertyMap model, Object bean, PropertyFilter propertyFilter)
Deprecated.Imports properties from a bean into a model map based on the properties in this model type.
Parameters:
model
- the model map to import values intobean
- the bean to get values frompropertyFilter
- defines which properties from this model type to import
-
resolveType
public ModelType resolveType(String modelPath)
Deprecated.Finds the model type denoted by the given model path.
Parameters:
modelPath
- the model path to resolve, notnull
Returns:
the model type of the resolved path, not
null
-
cast
public <C> BeanModelType<C> cast(Class<C> proxyType)
Deprecated.Description copied from interface:
ComplexModelType
Checks that this type uses the provided proxy type and returns this type as a model type with that proxy type.
Specified by:
cast
in interfaceComplexModelType<T>
Type Parameters:
C
- the proxy typeParameters:
proxyType
- the proxy type to cast toReturns:
this model type
-
getPropertyNames
public Stream<String> getPropertyNames()
Deprecated.Gets the names of all properties in this bean type.
Returns:
a stream of property names, not
null
-
accepts
public boolean accepts(Type applicationType)
Deprecated.Description copied from interface:
ModelType
Checks whether this type can accept application values of the given type. The method only considers this actual type, not the types of sub properties or list items.
-
getJavaType
public Type getJavaType()
Deprecated.Description copied from interface:
ModelType
Gets the Java
Type
that this model encapsulates.Specified by:
getJavaType
in interfaceModelType
Returns:
the java type
-
toJson
public elemental.json.JsonValue toJson()
Deprecated.Description copied from interface:
ModelType
Creates a JSON representation of this model type.
-
createInitialValue
public void createInitialValue(StateNode node, String property)
Deprecated.Description copied from interface:
ModelType
Create initial value for the given
property
and set it for thenode
.Specified by:
createInitialValue
in interfaceModelType
Parameters:
node
- the node where the initial value should be set theproperty
property
- the property in thenode
whose initial value needs to be created
-
createInitialValues
public void createInitialValues(StateNode node)
Deprecated.Creates initial values for the given
node
using info from this model type.Initial values are created for all sub-properties as well.
Parameters:
node
- the node whose properties need to be populated
-
getClientUpdateAllowedProperties
public Map<String,Boolean> getClientUpdateAllowedProperties(Set<String> twoWayBindingPaths)
Deprecated.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.
Parameters:
twoWayBindingPaths
- a set of path names for which two way bindings are defined in the templateReturns:
a map of properties whose update is allowed from the client-side and indicator of their getters presence
See Also:
ElementPropertyMap.setUpdateFromClientFilter(SerializablePredicate)
-
-