Class SimpleLambdaModel<T>

    • Method Detail

      • of

        public static <T> IModel<T> of​(SerializableSupplier<T> getter,
                                       SerializableConsumer<T> setter)
        Create a LambdaModel. Usage:
         
         	LambdaModel.of(person::getName, person::setName)
         
         
        Type Parameters:
        T - model object type
        Parameters:
        getter - used to get value
        setter - used to set value
        Returns:
        model
      • of

        public static <X,​T> IModel<T> of​(IModel<X> target,
                                               SerializableFunction<X,​T> getter)
        Create a LambdaModel for a given target. Usage:
         
         	LambdaModel.of(personModel, Person::getName)
         
         
        The target model will be detached automatically.
        Type Parameters:
        X - target model object type
        T - model object type
        Parameters:
        target - target for getter and setter
        getter - used to get a value
        Returns:
        model
      • of

        public static <X,​T> IModel<T> of​(IModel<X> target,
                                               SerializableFunction<X,​T> getter,
                                               SerializableBiConsumer<X,​T> setter)
        Create a LambdaModel for a given target. Usage:
         
         	LambdaModel.of(personModel, Person::getName, Person::setName)
         
         
        The target model will be detached automatically.
        Type Parameters:
        X - target model object type
        T - model object type
        Parameters:
        target - target for getter and setter
        getter - used to get a value
        setter - used to set a value
        Returns:
        model
      • attach

        public void attach()
        Attach an object.
        Specified by:
        attach in interface Attachable
      • detach

        public void detach()
        Detach an object.
        Specified by:
        detach in interface IDetachable
      • getObject

        public T getObject()
        Gets the model object.
        Specified by:
        getObject in interface IModel<T>
        Returns:
        The model object
      • setObject

        public void setObject​(T object)
        Sets the model object.
        Specified by:
        setObject in interface IModel<T>
        Parameters:
        object - The model object