Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

PropertyMap.java 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. Copyright (c) 2013 James Ahlborn
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package com.healthmarketscience.jackcess;
  14. import java.io.IOException;
  15. /**
  16. * Map of properties for a database object.
  17. *
  18. * @author James Ahlborn
  19. * @usage _general_class_
  20. */
  21. public interface PropertyMap extends Iterable<PropertyMap.Property>
  22. {
  23. public static final String ACCESS_VERSION_PROP = "AccessVersion";
  24. public static final String TITLE_PROP = "Title";
  25. public static final String AUTHOR_PROP = "Author";
  26. public static final String COMPANY_PROP = "Company";
  27. public static final String DEFAULT_VALUE_PROP = "DefaultValue";
  28. public static final String REQUIRED_PROP = "Required";
  29. public static final String ALLOW_ZERO_LEN_PROP = "AllowZeroLength";
  30. public static final String DECIMAL_PLACES_PROP = "DecimalPlaces";
  31. public static final String FORMAT_PROP = "Format";
  32. public static final String INPUT_MASK_PROP = "InputMask";
  33. public static final String CAPTION_PROP = "Caption";
  34. public static final String VALIDATION_RULE_PROP = "ValidationRule";
  35. public static final String VALIDATION_TEXT_PROP = "ValidationText";
  36. public static final String GUID_PROP = "GUID";
  37. public static final String DESCRIPTION_PROP = "Description";
  38. public static final String RESULT_TYPE_PROP = "ResultType";
  39. public static final String EXPRESSION_PROP = "Expression";
  40. public String getName();
  41. public int getSize();
  42. public boolean isEmpty();
  43. /**
  44. * @return the property with the given name, if any
  45. */
  46. public Property get(String name);
  47. /**
  48. * @return the value of the property with the given name, if any
  49. */
  50. public Object getValue(String name);
  51. /**
  52. * @return the value of the property with the given name, if any, otherwise
  53. * the given defaultValue
  54. */
  55. public Object getValue(String name, Object defaultValue);
  56. /**
  57. * Creates a new (or updates an existing) property in the map. Attempts to
  58. * determine the type of the property based on the name and value (the
  59. * property names listed above have their types builtin, otherwise the type
  60. * of the value is used).
  61. * <p/>
  62. * Note, this change will not be persisted until the {@link #save} method
  63. * has been called.
  64. *
  65. * @return the newly created (or updated) property
  66. * @throws IllegalArgumentException if the type of the property could not be
  67. * determined automatically
  68. */
  69. public Property put(String name, Object value);
  70. /**
  71. * Creates a new (or updates an existing) property in the map.
  72. * <p/>
  73. * Note, this change will not be persisted until the {@link #save} method
  74. * has been called.
  75. *
  76. * @return the newly created (or updated) property
  77. */
  78. public Property put(String name, DataType type, Object value);
  79. /**
  80. * Puts all the given properties into this map.
  81. *
  82. * @props the properties to put into this map ({@code null} is tolerated and
  83. * ignored).
  84. */
  85. public void putAll(Iterable<? extends Property> props);
  86. /**
  87. * Removes the property with the given name
  88. *
  89. * @return the removed property, or {@code null} if none found
  90. */
  91. public Property remove(String name);
  92. /**
  93. * Saves the current state of this map.
  94. */
  95. public void save() throws IOException;
  96. /**
  97. * Info about a property defined in a PropertyMap.
  98. */
  99. public interface Property
  100. {
  101. public String getName();
  102. public DataType getType();
  103. public Object getValue();
  104. /**
  105. * Sets the new value for this property.
  106. * <p/>
  107. * Note, this change will not be persisted until the {@link
  108. * PropertyMap#save} method has been called.
  109. */
  110. public void setValue(Object newValue);
  111. }
  112. }