Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

PropertyFilterDefinition.java 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.Arrays;
  19. import java.util.List;
  20. /**
  21. * Class containing the constraints for filtering nested properties.
  22. *
  23. * @author Vaadin Ltd
  24. * @since 8.2
  25. */
  26. public class PropertyFilterDefinition implements Serializable {
  27. private int maxNestingDepth;
  28. private List<String> ignorePackageNamesStartingWith;
  29. /**
  30. * Create a property filter with max nesting depth and package names to
  31. * ignore.
  32. *
  33. * @param maxNestingDepth
  34. * The maximum amount of nesting levels for sub-properties.
  35. * @param ignorePackageNamesStartingWith
  36. * Ignore package names that start with this string, for example
  37. * "java.lang".
  38. */
  39. public PropertyFilterDefinition(int maxNestingDepth,
  40. List<String> ignorePackageNamesStartingWith) {
  41. this.maxNestingDepth = maxNestingDepth;
  42. this.ignorePackageNamesStartingWith = ignorePackageNamesStartingWith;
  43. }
  44. /**
  45. * Returns the maximum amount of nesting levels for sub-properties.
  46. *
  47. * @return maximum nesting depth
  48. */
  49. public int getMaxNestingDepth() {
  50. return maxNestingDepth;
  51. }
  52. /**
  53. * Returns a list of package name prefixes to ignore.
  54. *
  55. * @return list of strings that
  56. */
  57. public List<String> getIgnorePackageNamesStartingWith() {
  58. return ignorePackageNamesStartingWith;
  59. }
  60. /**
  61. * Get the default nested property filtering conditions.
  62. *
  63. * @return default property filter
  64. */
  65. public static PropertyFilterDefinition getDefaultFilter() {
  66. return new PropertyFilterDefinition(
  67. BeanPropertySet.NestedBeanPropertyDefinition.MAX_PROPERTY_NESTING_DEPTH,
  68. Arrays.asList("java"));
  69. }
  70. }