⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tupleserialmarshalledkeycreator.java

📁 嵌入式数据库Berkeley DB-4.5.20源代码
💻 JAVA
字号:
/*- * See the file LICENSE for redistribution information. * * Copyright (c) 2000-2006 *      Oracle Corporation.  All rights reserved. * * $Id: TupleSerialMarshalledKeyCreator.java,v 12.3 2006/08/31 18:14:05 bostic Exp $ */package com.sleepycat.bind.serial;import com.sleepycat.bind.tuple.MarshalledTupleKeyEntity;import com.sleepycat.bind.tuple.TupleInput;import com.sleepycat.bind.tuple.TupleOutput;/** * A concrete key creator that works in conjunction with a {@link * TupleSerialMarshalledBinding}.  This key creator works by calling the * methods of the {@link MarshalledTupleKeyEntity} interface to create and * clear the index key fields. * * @author Mark Hayes */public class TupleSerialMarshalledKeyCreator extends TupleSerialKeyCreator {    private TupleSerialMarshalledBinding binding;    private String keyName;    /**     * Creates a tuple-serial marshalled key creator.     *     * @param binding is the binding used for the tuple-serial entity.     *     * @param keyName is the key name passed to the {@link     * MarshalledTupleKeyEntity#marshalSecondaryKey} method to identify the     * index key.     */    public TupleSerialMarshalledKeyCreator(TupleSerialMarshalledBinding                                           binding,                                           String keyName) {        super(binding.dataBinding);        this.binding = binding;        this.keyName = keyName;        if (dataBinding == null) {            throw new NullPointerException("dataBinding may not be null");        }    }    // javadoc is inherited    public boolean createSecondaryKey(TupleInput primaryKeyInput,                                      Object dataInput,                                      TupleOutput indexKeyOutput) {        /*         * The primary key is unmarshalled before marshalling the index key, to         * account for cases where the index key includes fields taken from the         * primary key.         */        MarshalledTupleKeyEntity entity = (MarshalledTupleKeyEntity)            binding.entryToObject(primaryKeyInput, dataInput);        return entity.marshalSecondaryKey(keyName, indexKeyOutput);    }    // javadoc is inherited    public Object nullifyForeignKey(Object dataInput) {        MarshalledTupleKeyEntity entity = (MarshalledTupleKeyEntity)            binding.entryToObject(null, dataInput);        return entity.nullifyForeignKey(keyName) ? dataInput : null;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -