1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package dev.metaschema.core.metapath.item.atomic.impl;
7   
8   import java.nio.ByteBuffer;
9   
10  import dev.metaschema.core.metapath.item.atomic.AbstractAnyAtomicItem;
11  import edu.umd.cs.findbugs.annotations.NonNull;
12  
13  /**
14   * An implementation of a Metapath atomic item containing a binary data value.
15   */
16  public abstract class AbstractBinaryItem
17      extends AbstractAnyAtomicItem<ByteBuffer>
18      implements IBinaryItem {
19  
20    /**
21     * Construct a new item with the provided {@code value}.
22     *
23     * @param value
24     *          the value to wrap
25     */
26    public AbstractBinaryItem(@NonNull ByteBuffer value) {
27      super(value);
28    }
29  
30    @Override
31    public ByteBuffer asByteBuffer() {
32      return getValue();
33    }
34  
35    @Override
36    protected String getValueSignature() {
37      return "'" + asString() + "'";
38    }
39  }