Interface ModelType

All Superinterfaces:
Serializable
All Known Subinterfaces:
ComplexModelType<T>
All Known Implementing Classes:
AbstractBasicModelType, BasicComplexModelType, BasicModelType, BeanModelType, ConvertedModelType, ListModelType, ModelDescriptor

@Deprecated public interface ModelType extends Serializable
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 that can convert values between a representation suitable for users and a representation suitable for storage in a StateNode.

Model type instances are shared between all instances of a given TemplateModel type and should therefore be immutable to prevent race conditions. The root type for a model can be found using ModelDescriptor.get(Class).

For internal use only. May be renamed or removed in a future release.

Since:
1.0
Author:
Vaadin Ltd
  • 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.
    void
    Deprecated.
    Create initial value for the given property and set it for the node.
    Deprecated.
    Gets the Java Type that this model encapsulates.
    static String
    Deprecated.
    Gets a string explaining the supported property types in model.
    Deprecated.
    Creates a representation of the provided model value that is intended for use in application code.
    elemental.json.JsonValue
    Deprecated.
    Creates a JSON representation of this model type.
  • Method Details

    • modelToApplication

      Object modelToApplication(Serializable modelValue) throws IllegalArgumentException
      Deprecated.
      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.
      Parameters:
      modelValue - the model value to convert
      Returns:
      a user-friendly representation of the provided model value
      Throws:
      IllegalArgumentException - if modelValue cannot be handled by the type
    • applicationToModel

      Serializable applicationToModel(Object applicationValue, PropertyFilter filter)
      Deprecated.
      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.

      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.
    • accepts

      boolean accepts(Type applicationType)
      Deprecated.
      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.
      Parameters:
      applicationType - the application type to check, not null
      Returns:
      true if the provided type is acceptable, false otherwise
    • getJavaType

      Type getJavaType()
      Deprecated.
      Gets the Java Type that this model encapsulates.
      Returns:
      the java type
    • getSupportedTypesString

      static String getSupportedTypesString()
      Deprecated.
      Gets a string explaining the supported property types in model.
      Returns:
      a string explaining supported property types
    • toJson

      elemental.json.JsonValue toJson()
      Deprecated.
      Creates a JSON representation of this model type.
      Returns:
      a JSON representation of this model type, not null
    • createInitialValue

      void createInitialValue(StateNode node, String property)
      Deprecated.
      Create initial value for the given property and set it for the node.
      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