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.

Row.java 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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.Date;
  16. import java.util.Map;
  17. import java.math.BigDecimal;
  18. import java.time.LocalDateTime;
  19. import com.healthmarketscience.jackcess.complex.ComplexValueForeignKey;
  20. import com.healthmarketscience.jackcess.util.OleBlob;
  21. /**
  22. * A row of data as column name->value pairs. Values are strongly typed, and
  23. * column names are case sensitive.
  24. *
  25. * @author James Ahlborn
  26. * @usage _general_class_
  27. */
  28. public interface Row extends Map<String,Object>
  29. {
  30. /**
  31. * @return the id of this row
  32. */
  33. public RowId getId();
  34. /**
  35. * Convenience method which gets the value for the row with the given name,
  36. * casting it to a String (DataTypes TEXT, MEMO, GUID).
  37. */
  38. public String getString(String name);
  39. /**
  40. * Convenience method which gets the value for the row with the given name,
  41. * casting it to a Boolean (DataType BOOLEAN).
  42. */
  43. public Boolean getBoolean(String name);
  44. /**
  45. * Convenience method which gets the value for the row with the given name,
  46. * casting it to a Byte (DataType BYTE).
  47. */
  48. public Byte getByte(String name);
  49. /**
  50. * Convenience method which gets the value for the row with the given name,
  51. * casting it to a Short (DataType INT).
  52. */
  53. public Short getShort(String name);
  54. /**
  55. * Convenience method which gets the value for the row with the given name,
  56. * casting it to a Integer (DataType LONG).
  57. */
  58. public Integer getInt(String name);
  59. /**
  60. * Convenience method which gets the value for the row with the given name,
  61. * casting it to a BigDecimal (DataTypes MONEY, NUMERIC).
  62. */
  63. public BigDecimal getBigDecimal(String name);
  64. /**
  65. * Convenience method which gets the value for the row with the given name,
  66. * casting it to a Float (DataType FLOAT).
  67. */
  68. public Float getFloat(String name);
  69. /**
  70. * Convenience method which gets the value for the row with the given name,
  71. * casting it to a Double (DataType DOUBLE).
  72. */
  73. public Double getDouble(String name);
  74. /**
  75. * Convenience method which gets the value for the row with the given name,
  76. * casting it to a Date (DataType SHORT_DATE_TIME).
  77. * @deprecated this is only valid for Database instances configured for the
  78. * legacy {@link DateTimeType#DATE}. Prefer using
  79. * {@link DateTimeType#LOCAL_DATE_TIME} and the corresponding
  80. * {@link #getLocalDateTime} method. Using Date is being phased
  81. * out and will eventually be removed.
  82. */
  83. @Deprecated
  84. public Date getDate(String name);
  85. /**
  86. * Convenience method which gets the value for the row with the given name,
  87. * casting it to a LocalDateTime (DataType SHORT_DATE_TIME or
  88. * EXT_DATE_TIME). This method will only work for Database instances
  89. * configured for {@link DateTimeType#LOCAL_DATE_TIME}.
  90. */
  91. public LocalDateTime getLocalDateTime(String name);
  92. /**
  93. * Convenience method which gets the value for the row with the given name,
  94. * casting it to a byte[] (DataTypes BINARY, OLE).
  95. */
  96. public byte[] getBytes(String name);
  97. /**
  98. * Convenience method which gets the value for the row with the given name,
  99. * casting it to a {@link ComplexValueForeignKey} (DataType COMPLEX_TYPE).
  100. */
  101. public ComplexValueForeignKey getForeignKey(String name);
  102. /**
  103. * Convenience method which gets the value for the row with the given name,
  104. * converting it to an {@link OleBlob} (DataTypes OLE).
  105. * <p>
  106. * Note, <i>the OleBlob should be closed after use</i>.
  107. */
  108. public OleBlob getBlob(String name) throws IOException;
  109. }