You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Setter.java 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.server;
  17. import java.io.Serializable;
  18. import java.util.function.BiConsumer;
  19. import com.vaadin.data.Binder;
  20. import com.vaadin.data.HasValue;
  21. /**
  22. * The function to write the field value to the bean property
  23. *
  24. * @see BiConsumer
  25. * @see Binder#bind(HasValue, SerializableFunction, Setter)
  26. * @param <BEAN>
  27. * the type of the target bean
  28. * @param <FIELDVALUE>
  29. * the field value type to be written to the bean
  30. *
  31. * @since 8.0
  32. * @author Vaadin Ltd
  33. *
  34. */
  35. @FunctionalInterface
  36. public interface Setter<BEAN, FIELDVALUE>
  37. extends BiConsumer<BEAN, FIELDVALUE>, Serializable {
  38. /**
  39. * Save value to the bean property
  40. *
  41. * @param bean
  42. * the target bean
  43. * @param fieldvalue
  44. * the field value to be written to the bean
  45. */
  46. @Override
  47. void accept(BEAN bean, FIELDVALUE fieldvalue);
  48. }