com.sleepycat.persist.impl.EntityOutput Maven / Gradle / Ivy
The newest version!
/*-
* Copyright (C) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
*
* This file was distributed by Oracle as part of a version of Oracle Berkeley
* DB Java Edition made available at:
*
* http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html
*
* Please see the LICENSE file included in the top-level directory of the
* appropriate version of Oracle Berkeley DB Java Edition for a copy of the
* license and additional information.
*/
package com.sleepycat.persist.impl;
import java.math.BigDecimal;
import java.math.BigInteger;
import com.sleepycat.bind.tuple.TupleOutput;
/**
* Used for writing object fields.
*
* Unlike TupleOutput, Strings should be passed to {@link #writeObject} when
* using this class.
*
* Note that currently there is only one implementation of EntityOutput:
* RecordOutput. There is no RawObjectOutput implemention because we currently
* have no need to convert from persistent objects to RawObject instances.
* The EntityOutput interface is only for symmetry with EntityInput and in case
* we need RawObjectOutput in the future.
*
* @author Mark Hayes
*/
public interface EntityOutput {
/**
* Called via Accessor to write all fields with reference types, except for
* the primary key field and composite key fields (see writeKeyObject
* below).
*/
void writeObject(Object o, Format fieldFormat)
throws RefreshException;
/**
* Called for a primary key field or composite key field with a reference
* type.
*/
void writeKeyObject(Object o, Format fieldFormat)
throws RefreshException;
/**
* Called via Accessor.writeSecKeyFields for a primary key field with a
* reference type. This method must be called before writing any other
* fields.
*/
void registerPriKeyObject(Object o);
/**
* Called by ObjectArrayFormat and PrimitiveArrayFormat to write the array
* length.
*/
void writeArrayLength(int length);
/**
* Called by EnumFormat to write the given index of the enum constant.
*/
void writeEnumConstant(String[] names, int index);
/* The following methods are a subset of the methods in TupleOutput. */
TupleOutput writeString(String val);
TupleOutput writeChar(int val);
TupleOutput writeBoolean(boolean val);
TupleOutput writeByte(int val);
TupleOutput writeShort(int val);
TupleOutput writeInt(int val);
TupleOutput writeLong(long val);
TupleOutput writeSortedFloat(float val);
TupleOutput writeSortedDouble(double val);
TupleOutput writeBigInteger(BigInteger val);
TupleOutput writeSortedBigDecimal(BigDecimal val);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy