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

org.loom.simpleds.functions.Base58IdToKeyFunction Maven / Gradle / Ivy

The newest version!
package org.loom.simpleds.functions;

import org.loom.util.StringUtils;
import org.simpleds.functions.AbstractPartialKeyFunction;

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

/**
 * Transform a Base58 representation of the id to the corresponding Key value
 * @see KeyToBase58IdFunction
 * @author icoloma
 */
public class Base58IdToKeyFunction extends AbstractPartialKeyFunction {

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

	@Override
	public Key apply(String key) {
		return key == null? null : KeyFactory.createKey(kind, StringUtils.alphaToNumber(key));
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy