Logo Search packages:      
Sourcecode: db version File versions

void com::sleepycat::collections::DataView::useValue ( Object  value,
DatabaseEntry  valueThang,
DatabaseEntry  checkKeyThang 
) throws DatabaseException [inline, package]

Populates the value entry and throws an exception if the primary key would be changed via an entity binding.

Definition at line 536 of file DataView.java.

References com::sleepycat::bind::EntityBinding::objectToData(), com::sleepycat::bind::EntryBinding::objectToEntry(), and com::sleepycat::bind::EntityBinding::objectToKey().

Referenced by append(), com::sleepycat::collections::DataCursor::findBoth(), com::sleepycat::collections::DataCursor::findValue(), com::sleepycat::collections::DataCursor::initForPut(), com::sleepycat::collections::DataCursor::putAfter(), com::sleepycat::collections::DataCursor::putBefore(), and com::sleepycat::collections::DataCursor::putCurrent().

                                 {

        if (value != null) {
            if (valueBinding != null) {
                valueBinding.objectToEntry(value, valueThang);
            } else if (entityBinding != null) {
                entityBinding.objectToData(value, valueThang);
                if (checkKeyThang != null) {
                    DatabaseEntry thang = new DatabaseEntry();
                    entityBinding.objectToKey(value, thang);
                    if (!KeyRange.equalBytes(thang, checkKeyThang)) {
                        throw new IllegalArgumentException(
                            "cannot change primary key");
                    }
                }
            } else {
                throw new IllegalArgumentException(
                    "non-null value with null value/entity binding");
            }
        } else {
            valueThang.setData(KeyRange.ZERO_LENGTH_BYTE_ARRAY);
            valueThang.setOffset(0);
            valueThang.setSize(0);
        }
    }


Generated by  Doxygen 1.6.0   Back to index