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.

PropertyDefinition.java 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright 2000-2018 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.data;
  17. import java.io.Serializable;
  18. import java.util.Optional;
  19. import com.vaadin.server.Setter;
  20. /**
  21. * A property from a {@link PropertySet}.
  22. *
  23. * @author Vaadin Ltd
  24. * @since 8.0
  25. *
  26. * @param <T>
  27. * the type of the property set
  28. * @param <V>
  29. * the property type
  30. */
  31. public interface PropertyDefinition<T, V> extends Serializable {
  32. /**
  33. * Gets the value provider that is used for finding the value of this
  34. * property for a bean.
  35. *
  36. * @return the getter, not <code>null</code>
  37. */
  38. public ValueProvider<T, V> getGetter();
  39. /**
  40. * Gets an optional setter for storing a property value in a bean.
  41. *
  42. * @return the setter, or an empty optional if this property is read-only
  43. */
  44. public Optional<Setter<T, V>> getSetter();
  45. /**
  46. * Gets the type of this property.
  47. *
  48. * @return the property type. not <code>null</code>
  49. */
  50. public Class<V> getType();
  51. /**
  52. * Gets the type of the class containing this property.
  53. *
  54. * @since 8.1
  55. *
  56. * @return the property type. not <code>null</code>
  57. */
  58. public Class<?> getPropertyHolderType();
  59. /**
  60. * Gets the full name of this property.
  61. *
  62. * @return the property name, not <code>null</code>
  63. */
  64. public String getName();
  65. /**
  66. * Gets the top level name of this property.
  67. *
  68. * @return the top level property name, not <code>null</code>
  69. * @since 8.3
  70. */
  71. public default String getTopLevelName() {
  72. return getName();
  73. }
  74. /**
  75. * Gets the human readable caption to show for this property.
  76. *
  77. * @return the caption to show, not <code>null</code>
  78. */
  79. public String getCaption();
  80. /**
  81. * Gets the {@link PropertySet} that this property belongs to.
  82. *
  83. * @return the property set, not <code>null</code>
  84. */
  85. public PropertySet<T> getPropertySet();
  86. }