List of usage examples for com.google.gson.internal Primitives unwrap
@SuppressWarnings("unchecked") public static <T> Class<T> unwrap(Class<T> type)
From source file:org.apache.aurora.scheduler.storage.testing.StorageEntityUtil.java
License:Apache License
private static void validateField(String name, Object object, Field field, Set<Field> ignoredFields) { try {/*from w ww. j a v a 2 s. c o m*/ field.setAccessible(true); String fullName = name + "." + field.getName(); Object fieldValue = field.get(object); boolean mustBeSet = !ignoredFields.contains(field); if (mustBeSet) { assertNotNull(fullName + " is null", fieldValue); } if (fieldValue != null) { if (Primitives.isWrapperType(fieldValue.getClass())) { // Special-case the mutable hash code field. if (mustBeSet && !fullName.endsWith("cachedHashCode")) { assertNotEquals("Primitive value must not be default: " + fullName, Defaults.defaultValue(Primitives.unwrap(fieldValue.getClass())), fieldValue); } } else { assertFullyPopulated(fullName, fieldValue, ignoredFields); } } } catch (IllegalAccessException e) { throw Throwables.propagate(e); } }