com.google.api.client.util.Key Java Examples
The following examples show how to use
com.google.api.client.util.Key.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RepositoryDocTest.java From connector-sdk with Apache License 2.0 | 6 votes |
/** * Check whether a GenericJson subclass is really cloneable. Most notably, GenericJson.clone fails * on immutable collections. This test is more conservative, allowing only Boolean, Number, and * String fields, and nested GenericJson objects. */ // TODO(jlacey): This could be a Matcher, or otherwise return the offending class. private boolean isCloneable(Class<?> jsonClass) { if (!GenericJson.class.isAssignableFrom(jsonClass)) { return false; } Field[] fields = jsonClass.getDeclaredFields(); for (Field field : fields) { Key key = field.getAnnotation(Key.class); if (key != null) { Class<?> clazz = field.getType(); if (!Boolean.class.isAssignableFrom(clazz) && !Number.class.isAssignableFrom(clazz) && !String.class.isAssignableFrom(clazz) && !isCloneable(clazz)) { return false; } } } return true; }