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.

TableDefinitionImpl.java 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. Copyright (c) 2022 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.impl;
  14. import java.io.IOException;
  15. import java.nio.ByteBuffer;
  16. import java.util.List;
  17. /**
  18. * A database table definition which does not allow any actual data
  19. * interaction (read or write).
  20. * <p>
  21. * Note, in an ideal world, TableImpl would extend TableDefinitionImpl.
  22. * However, since TableDefinitionImpl came later, it was easier to do it this
  23. * way and avoid a lot of unnecessary code shuffling.
  24. * <p>
  25. * Is not thread-safe.
  26. *
  27. * @author James Ahlborn
  28. * @usage _advanced_class_
  29. */
  30. public class TableDefinitionImpl extends TableImpl
  31. {
  32. protected TableDefinitionImpl(DatabaseImpl database, ByteBuffer tableBuffer,
  33. int pageNumber, String name, int flags)
  34. throws IOException {
  35. super(database, tableBuffer, pageNumber, name, flags);
  36. }
  37. @Override
  38. protected List<? extends Object[]> addRows(List<? extends Object[]> rows,
  39. final boolean isBatchWrite)
  40. throws IOException {
  41. // all row additions eventually flow through this method
  42. throw new UnsupportedOperationException(
  43. withErrorContext("TableDefinition has no data access"));
  44. }
  45. @Override
  46. public RowState createRowState() {
  47. // RowState is needed for all traversal operations, so this kills any data
  48. // reading as well as update/delete methods
  49. throw new UnsupportedOperationException(
  50. withErrorContext("TableDefinition has no data access"));
  51. }
  52. }