![JAR search and dependency download from the Maven repository](/logo.png)
org.loom.appengine.converter.KeyIdConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of loom-appengine Show documentation
Show all versions of loom-appengine Show documentation
Uploads all artifacts belonging to configuration ':archives'.
The newest version!
package org.loom.appengine.converter;
import org.loom.util.StringUtils;
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 id value, converted to alpha string.
*
* @author icoloma
*
*/
public class KeyIdConverter extends AbstractRootKeyConverter {
public KeyIdConverter(Class> persistentClass) {
super(persistentClass);
}
@Override
protected Object getAsObjectImpl(String paramName, String paramValue) {
return KeyFactory.createKey(kind, StringUtils.alphaToNumber(paramValue));
}
@Override
protected String getAsTextImpl(Key key) {
return StringUtils.numberToAlpha(key.getId());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy