How to retrieve data types of properties of entities stored in Google App Engine Datastore using Java? I didn't find property.getType() or similar method in Java Datastore API.
There is no direct method provided.
but you can retrieve it by comparing the java Type of Property with the table given at this link
Map<String, Object> properties = entity.getProperties();
String[] propertyNames = properties.keySet().toArray(
new String[properties.size()]);
for(final String propertyName : propertyNames) {
// propertyNames string contains
// "com.google.appengine.api.users.User" then its Google Accounts user
// "java.lang.Integer" then its Integer
// "int" then premetive integer
}
Hope this helps
You need to use Property Metadata Queries .
Be aware that, as stated in the documentation, the property representation returned by the queries would be AppEngine representation, and does not have one-to-one mapping with Java classes. But you would be able to get the general data type at least.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.