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.7KB

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