Package 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 type
- All Implemented Interfaces:
ComplexModelType<T>,ModelType,Serializable
- Direct Known Subclasses:
ModelDescriptor
@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@Idmapping and the component API or the element API with property synchronization instead. Polymer template support is deprecated - we recommend you to useLitTemplateinstead. 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:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBeanModelType(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.protectedBeanModelType(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 Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanaccepts(Type applicationType)Deprecated.Checks whether this type can accept application values of the given type.StateNodeapplicationToModel(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.voidcreateInitialValue(StateNode node, String property)Deprecated.Create initial value for the givenpropertyand set it for thenode.voidcreateInitialValues(StateNode node)Deprecated.Creates initial values for the givennodeusing 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 ClientUpdateModegetClientUpdateMode(com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty property)Deprecated.Gets the client update mode for a property.protected com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypePropertygetExistingProperty(String propertyName)Deprecated.TypegetJavaType()Deprecated.Gets the JavaTypethat this model encapsulates.Stream<String>getPropertyNames()Deprecated.Gets the names of all properties in this bean type.ModelTypegetPropertyType(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.booleanhasProperty(String propertyName)Deprecated.Checks whether this bean type has a property with the given name.voidimportProperties(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 booleanisBean(Type type)Deprecated.Checks if the given type can be handled as a bean in a model.TmodelToApplication(Serializable modelValue)Deprecated.Creates a representation of the provided model value that is intended for use in application code.ModelTyperesolveType(String modelPath)Deprecated.Finds the model type denoted by the given model path.elemental.json.JsonValuetoJson()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, notnullproperties- a map of properties of this type. The contents of the map will be copied. Notnull.allowEmptyProperties- iffalsethen empty properties value is not accepted- Throws:
IllegalStateException- ifallowEmptyPropertiesisfalseandpropertiesis 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- iffalsethen empty properties value is not accepted- Throws:
IllegalStateException- ifallowEmptyPropertiesisfalseandpropertyFilterresolves 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 check- Returns:
trueif the given type will be handled as a bean,falseif 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 check- Returns:
trueif this model has a property with the given name;falseotherwise
-
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 check- Returns:
- 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 mode- Returns:
- the client update mode, or IF_TWO_WAY_BINDING if no mode has been explicitly configured
- See Also:
AllowClientUpdates
-
getExistingProperty
protected com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty getExistingProperty(String propertyName)
Deprecated.
-
modelToApplication
public T modelToApplication(Serializable modelValue)
Deprecated.Description copied from interface:ModelTypeCreates 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:
modelToApplicationin interfaceModelType- Parameters:
modelValue- the model value to convert- Returns:
- 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:ModelTypeCreates 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:
applicationToModelin interfaceComplexModelType<T>- Specified by:
applicationToModelin 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:ComplexModelTypeChecks that this type uses the provided proxy type and returns this type as a model type with that proxy type.- Specified by:
castin interfaceComplexModelType<T>- Type Parameters:
C- the proxy type- Parameters:
proxyType- the proxy type to cast to- Returns:
- 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:ModelTypeChecks 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:ModelTypeGets the JavaTypethat this model encapsulates.- Specified by:
getJavaTypein interfaceModelType- Returns:
- the java type
-
toJson
public elemental.json.JsonValue toJson()
Deprecated.Description copied from interface:ModelTypeCreates a JSON representation of this model type.
-
createInitialValue
public void createInitialValue(StateNode node, String property)
Deprecated.Description copied from interface:ModelTypeCreate initial value for the givenpropertyand set it for thenode.- Specified by:
createInitialValuein interfaceModelType- Parameters:
node- the node where the initial value should be set thepropertyproperty- the property in thenodewhose initial value needs to be created
-
createInitialValues
public void createInitialValues(StateNode node)
Deprecated.Creates initial values for the givennodeusing 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 template- Returns:
- a map of properties whose update is allowed from the client-side and indicator of their getters presence
- See Also:
ElementPropertyMap.setUpdateFromClientFilter(SerializablePredicate)
-
-