Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

PropertyMap.java 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 static final String ALLOW_MULTI_VALUE_PROP = "AllowMultipleValues";
  41. public static final String ROW_SOURCE_TYPE_PROP = "RowSourceType";
  42. public static final String ROW_SOURCE_PROP = "RowSource";
  43. public String getName();
  44. public int getSize();
  45. public boolean isEmpty();
  46. /**
  47. * @return the property with the given name, if any
  48. */
  49. public Property get(String name);
  50. /**
  51. * @return the value of the property with the given name, if any
  52. */
  53. public Object getValue(String name);
  54. /**
  55. * @return the value of the property with the given name, if any, otherwise
  56. * the given defaultValue
  57. */
  58. public Object getValue(String name, Object defaultValue);
  59. /**
  60. * Creates a new (or updates an existing) property in the map. Attempts to
  61. * determine the type of the property based on the name and value (the
  62. * property names listed above have their types builtin, otherwise the type
  63. * of the value is used).
  64. * <p/>
  65. * Note, this change will not be persisted until the {@link #save} method
  66. * has been called.
  67. *
  68. * @return the newly created (or updated) property
  69. * @throws IllegalArgumentException if the type of the property could not be
  70. * determined automatically
  71. */
  72. public Property put(String name, Object value);
  73. /**
  74. * Creates a new (or updates an existing) property in the map.
  75. * <p/>
  76. * Note, this change will not be persisted until the {@link #save} method
  77. * has been called.
  78. *
  79. * @return the newly created (or updated) property
  80. */
  81. public Property put(String name, DataType type, Object value);
  82. /**
  83. * Creates a new (or updates an existing) property in the map.
  84. * <p/>
  85. * Note, this change will not be persisted until the {@link #save} method
  86. * has been called.
  87. *
  88. * @return the newly created (or updated) property
  89. */
  90. public Property put(String name, DataType type, Object value, boolean isDdl);
  91. /**
  92. * Puts all the given properties into this map.
  93. *
  94. * @param props the properties to put into this map ({@code null} is
  95. * tolerated and ignored).
  96. */
  97. public void putAll(Iterable<? extends Property> props);
  98. /**
  99. * Removes the property with the given name
  100. *
  101. * @return the removed property, or {@code null} if none found
  102. */
  103. public Property remove(String name);
  104. /**
  105. * Saves the current state of this map.
  106. */
  107. public void save() throws IOException;
  108. /**
  109. * Info about a property defined in a PropertyMap.
  110. */
  111. public interface Property
  112. {
  113. public String getName();
  114. public DataType getType();
  115. /**
  116. * Whether or not this property is a DDL object. If {@code true}, users
  117. * can't change or delete the property in access without the dbSecWriteDef
  118. * permission. Additionally, certain properties must be flagged correctly
  119. * or the access engine may not recognize them correctly.
  120. */
  121. public boolean isDdl();
  122. public Object getValue();
  123. /**
  124. * Sets the new value for this property.
  125. * <p/>
  126. * Note, this change will not be persisted until the {@link
  127. * PropertyMap#save} method has been called.
  128. */
  129. public void setValue(Object newValue);
  130. }
  131. }