All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.persistit.encoding.KeyDisplayer Maven / Gradle / Ivy

There is a newer version: 3.3.0
Show newest version
/**
 * Copyright © 2005-2012 Akiban Technologies, Inc.  All rights reserved.
 * 
 * This program and the accompanying materials are made available
 * under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * This program may also be available under different license terms.
 * For more information, see www.akiban.com or contact [email protected].
 * 
 * Contributors:
 * Akiban Technologies, Inc.
 */

package com.persistit.encoding;

import com.persistit.Key;
import com.persistit.exception.ConversionException;

/**
 * 

* An extension of {@link KeyCoder} that adds the {@link #displayKeySegment} * method. This method populates a supplied Appendable with a * displayable, human-readable representation of the Object value that was * formerly written to a {@link Key} by this KeyDisplayer. *

*

* The {@link Key#toString toString} method and * {@link Key#decodeDisplayable(boolean, Appendable, CoderContext) * decodeDisplayable} methods of Value preferentially use the * registered KeyDisplayer, if present, to generate a String * representation of an object value encoded in a Key. *

* * @version 1.0 */ public interface KeyDisplayer extends KeyCoder { /** *

* Populates the state of the supplied target Object by * decoding the next key segment of the supplied Key. This * method will be called only if this KeyRenderer has been * registered with the current {@link CoderManager} to encode objects having * the supplied Class value. In addition, Persistit will never * call this method to decode a value that was null when * written because null values are handled by built-in encoding logic. *

*

* When this method is called the value {@link Key#getIndex()} will be the * offset within the key of the first encoded byte. The key segment is * zero-byte terminated. *

* * @param key * The Key from which interior fields of the object * are to be retrieved * * @param target * An @{link Appendable} object into which the key segment is to * be written * * @param clazz * The class of the object that was originally encoded into * Value. * * @param context * An arbitrary object that can optionally be supplied by the * application to convey an application-specific context for the * operation. (See {@link CoderContext}.) The default value is * null. * * @throws ConversionException */ public void displayKeySegment(Key key, Appendable target, Class clazz, CoderContext context) throws ConversionException; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy