本文整理匯總了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());
}