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.

Column.java 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. import java.util.Map;
  16. import com.healthmarketscience.jackcess.complex.ComplexColumnInfo;
  17. import com.healthmarketscience.jackcess.complex.ComplexValue;
  18. import com.healthmarketscience.jackcess.util.ColumnValidator;
  19. /**
  20. * Access database column definition. A {@link Table} has a list of Column
  21. * instances describing the table schema.
  22. * <p>
  23. * A Column instance is not thread-safe (see {@link Database} for more
  24. * thread-safety details).
  25. *
  26. * @author James Ahlborn
  27. * @usage _general_class_
  28. */
  29. public interface Column
  30. {
  31. /**
  32. * Meaningless placeholder object for inserting values in an autonumber
  33. * column. it is not required that this value be used (any passed in value
  34. * is ignored), but using this placeholder may make code more obvious.
  35. * @usage _general_field_
  36. */
  37. public static final Object AUTO_NUMBER = "<AUTO_NUMBER>";
  38. /**
  39. * Meaningless placeholder object for updating rows which indicates that a
  40. * given column should keep its existing value.
  41. * @usage _general_field_
  42. */
  43. public static final Object KEEP_VALUE = "<KEEP_VALUE>";
  44. /**
  45. * @usage _general_method_
  46. */
  47. public Table getTable();
  48. /**
  49. * @usage _general_method_
  50. */
  51. public Database getDatabase();
  52. /**
  53. * @usage _general_method_
  54. */
  55. public String getName();
  56. /**
  57. * @usage _advanced_method_
  58. */
  59. public boolean isVariableLength();
  60. /**
  61. * @usage _general_method_
  62. */
  63. public boolean isAutoNumber();
  64. /**
  65. * @usage _advanced_method_
  66. */
  67. public int getColumnIndex();
  68. /**
  69. * @usage _general_method_
  70. */
  71. public DataType getType();
  72. /**
  73. * @usage _general_method_
  74. */
  75. public int getSQLType() throws IOException;
  76. /**
  77. * @usage _general_method_
  78. */
  79. public boolean isCompressedUnicode();
  80. /**
  81. * @usage _general_method_
  82. */
  83. public byte getPrecision();
  84. /**
  85. * @usage _general_method_
  86. */
  87. public byte getScale();
  88. /**
  89. * @usage _general_method_
  90. */
  91. public short getLength();
  92. /**
  93. * @usage _general_method_
  94. */
  95. public short getLengthInUnits();
  96. /**
  97. * Whether or not this column is "append only" (its history is tracked by a
  98. * separate version history column).
  99. * @usage _general_method_
  100. */
  101. public boolean isAppendOnly();
  102. /**
  103. * Returns whether or not this is a hyperlink column (only possible for
  104. * columns of type MEMO).
  105. * @usage _general_method_
  106. */
  107. public boolean isHyperlink();
  108. /**
  109. * Returns whether or not this is a calculated column. Note that jackess
  110. * <b>won't interpret the calculation expression</b> (but the field can be
  111. * written directly).
  112. * @usage _general_method_
  113. */
  114. public boolean isCalculated();
  115. /**
  116. * Returns extended functionality for "complex" columns.
  117. * @usage _general_method_
  118. */
  119. public ComplexColumnInfo<? extends ComplexValue> getComplexInfo();
  120. /**
  121. * @return the properties for this column
  122. * @usage _general_method_
  123. */
  124. public PropertyMap getProperties() throws IOException;
  125. /**
  126. * Returns the column which tracks the version history for an "append only"
  127. * column.
  128. * @usage _intermediate_method_
  129. */
  130. public Column getVersionHistoryColumn();
  131. /**
  132. * Gets currently configured ColumnValidator (always non-{@code null}).
  133. * @usage _intermediate_method_
  134. */
  135. public ColumnValidator getColumnValidator();
  136. /**
  137. * Sets a new ColumnValidator. If {@code null}, resets to the value
  138. * returned from the Database's ColumnValidatorFactory (if the factory
  139. * returns {@code null}, then the default is used). Autonumber columns
  140. * cannot have a validator instance other than the default.
  141. * @throws IllegalArgumentException if an attempt is made to set a
  142. * non-{@code null} ColumnValidator instance on an autonumber column
  143. * @usage _intermediate_method_
  144. */
  145. public void setColumnValidator(ColumnValidator newValidator);
  146. public Object setRowValue(Object[] rowArray, Object value);
  147. public Object setRowValue(Map<String,Object> rowMap, Object value);
  148. public Object getRowValue(Object[] rowArray);
  149. public Object getRowValue(Map<String,?> rowMap);
  150. }