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 @Id mapping and the component API or the element API with property synchronization instead. Polymer template support is deprecated - we recommend you to use LitTemplate 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

    Modifier and Type
    Method
    Description
    boolean
    accepts(Type applicationType)
    Deprecated.
    Checks whether this type can accept application values of the given type.
    applicationToModel(Object applicationValue, PropertyFilter filter)
    Deprecated.
    Creates a model value representation of the provided application value.
    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
    Deprecated.
    Create initial value for the given property and set it for the node.
    void
    Deprecated.
    Creates initial values for the given node using info from this model type.
    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.
    getClientUpdateMode(com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty property)
    Deprecated.
    Gets the client update mode for a property.
    protected com.vaadin.flow.templatemodel.BeanModelType.BeanModelTypeProperty
    Deprecated.
     
    Deprecated.
    Gets the Java Type that this model encapsulates.
    Deprecated.
    Gets the names of all properties in this bean type.
    getPropertyType(String propertyName)
    Deprecated.
    Gets the type of the property with the given name.
    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
    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.
    Deprecated.
    Creates a representation of the provided model value that is intended for use in application code.
    resolveType(String modelPath)
    Deprecated.
    Finds the model type denoted by the given model path.
    elemental.json.JsonValue
    Deprecated.
    Creates a JSON representation of this model type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • 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, not null
      properties - 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 accepted
      Throws:
      IllegalStateException - if allowEmptyProperties is false and properties 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 type
      propertyFilter - the filter that determines which bean properties to include in this model type
      allowEmptyProperties - if false then empty properties value is not accepted
      Throws:
      IllegalStateException - if allowEmptyProperties is false and propertyFilter resolves empty properties
  • Method Details

    • 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:
      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 check
      Returns:
      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 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:
    • 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 interface ModelType
      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: 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 interface ComplexModelType<T>
      Specified by:
      applicationToModel in interface ModelType
      Parameters:
      applicationValue - the user value to convert
      filter - the filter to use to determine which properties to include, not null
      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 into
      bean - the bean to get values from
      propertyFilter - 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, not null
      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 interface ComplexModelType<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: 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.
      Specified by:
      accepts in interface ModelType
      Parameters:
      applicationType - the application type to check, not null
      Returns:
      true if the provided type is acceptable, false otherwise
    • getJavaType

      public Type getJavaType()
      Deprecated.
      Description copied from interface: ModelType
      Gets the Java Type that this model encapsulates.
      Specified by:
      getJavaType in interface ModelType
      Returns:
      the java type
    • toJson

      public elemental.json.JsonValue toJson()
      Deprecated.
      Description copied from interface: ModelType
      Creates a JSON representation of this model type.
      Specified by:
      toJson in interface ModelType
      Returns:
      a JSON representation of this model type, not null
    • 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 the node.
      Specified by:
      createInitialValue in interface ModelType
      Parameters:
      node - the node where the initial value should be set the property
      property - the property in the node 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 template
      Returns:
      a map of properties whose update is allowed from the client-side and indicator of their getters presence
      See Also: