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

org.loom.appengine.converter.KeyNameConverter Maven / Gradle / Ivy

The newest version!
package org.loom.appengine.converter;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

/**
 * Converts a Google AppEngine Key to/from a String.
 * This converter can only be used for root entities. It stores the Key kind and will only 
 * serialize/deserialize the name value.
 * @author icoloma
 *
 */
public class KeyNameConverter extends AbstractRootKeyConverter {

	public KeyNameConverter(Class persistentClass) {
		super(persistentClass);
	}

	@Override
	protected Object getAsObjectImpl(String paramName, String paramValue) {
		return KeyFactory.createKey(kind, paramValue);
	}

	@Override
	protected String getAsTextImpl(Key key) {
		return key.getName();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy