本文整理汇总了Java中com.google.appengine.api.datastore.Key.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Key.getName方法的具体用法?Java Key.getName怎么用?Java Key.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.appengine.api.datastore.Key
的用法示例。
在下文中一共展示了Key.getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toModel
import com.google.appengine.api.datastore.Key; //导入方法依赖的package包/类
@Override
public <T> T toModel(Class<T> entityClass, Entity entity) {
try {
T instance = entityClass.newInstance();
Field idField = getIdField(entityClass);
Key key = entity.getKey();
Object id = (key.getName() != null ? key.getName() : key.getId());
idField.set(instance, id);
Map<String, Object> properties = entity.getProperties();
for (Map.Entry<String, Object> entry : properties.entrySet()) {
Field field = ReflectionUtils.findRequiredField(entityClass, entry.getKey());
ReflectionUtils.setField(field, instance, entry.getValue());
}
return instance;
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
示例2: ResetPasswordRequest
import com.google.appengine.api.datastore.Key; //导入方法依赖的package包/类
public ResetPasswordRequest(String requestId, Key userKey, Date dateRequested) {
this.entity = new Entity(DatastoreProperties.KIND.getName(), userKey.getName());
this.entity.setProperty(DatastoreProperties.REQUEST_ID.getName(), requestId);
this.entity.setProperty(DatastoreProperties.USER_KEY.getName(), userKey);
this.entity.setProperty(DatastoreProperties.DATE_REQUESTED.getName(), MiscFunctions.toUTCDateString(dateRequested));
Calendar dateOfExpiration = MiscFunctions.toCalendar(dateRequested);
dateOfExpiration.add(Calendar.DATE, DEFAULT_DAYS_OF_EXPIRATION);
this.entity.setProperty(DatastoreProperties.DATE_OF_EXPIRATION.getName(), MiscFunctions.toUTCDateString(dateOfExpiration.getTime()));
}
示例3: ChangeEmailAddressRequest
import com.google.appengine.api.datastore.Key; //导入方法依赖的package包/类
public ChangeEmailAddressRequest(String requestId, Key userKey, String emailAddress, Date dateRequested) {
this.entity = new Entity(DatastoreProperties.KIND.getName(), userKey.getName());
this.entity.setProperty(DatastoreProperties.REQUEST_ID.getName(), requestId);
this.entity.setProperty(DatastoreProperties.USER_KEY.getName(), userKey);
this.entity.setProperty(DatastoreProperties.EMAIL_ADDRESS.getName(), emailAddress);
this.entity.setProperty(DatastoreProperties.DATE_REQUESTED.getName(), MiscFunctions.toUTCDateString(dateRequested));
}
示例4: parseRootEntityKey
import com.google.appengine.api.datastore.Key; //导入方法依赖的package包/类
static SlobId parseRootEntityKey(String entityGroupKind, Key key) {
Preconditions.checkArgument(entityGroupKind.equals(key.getKind()),
"Key doesn't have kind %s: %s", entityGroupKind, key);
return new SlobId(key.getName());
}