private static Deque<Object> createWorkStack(Object rootObj, HashMap<Class<?>, ObjectEstimator> byType) { Deque<Object> stack = new ArrayDeque<Object>(32); Class<?> rootClass = rootObj.getClass(); if (Class.class.equals(rootClass)) { rootClass = (Class<?>) rootObj; rootObj = null; } else { // If root object is an array, map or collection, add estimators as for fields if (rootClass.isArray() && !rootClass.getComponentType().isPrimitive()) { addArrayEstimator(byType, stack, null, rootObj); } else if (Collection.class.isAssignableFrom(rootClass)) { addCollectionEstimator(byType, stack, null, rootClass, rootObj); } else if (Map.class.isAssignableFrom(rootClass)) { addMapEstimator(byType, stack, null, rootClass, rootObj); } } addToProcessing(byType, stack, rootObj, rootClass); return stack; }
} else if (Collection.class.isAssignableFrom(fieldClass)) { estimator.addField(FieldType.COLLECTION, field); addCollectionEstimator(byType, stack, field, fieldClass, fieldObj); } else if (Map.class.isAssignableFrom(fieldClass)) { estimator.addField(FieldType.MAP, field);
private static Deque<Object> createWorkStack(Object rootObj, HashMap<Class<?>, ObjectEstimator> byType) { Deque<Object> stack = new ArrayDeque<Object>(32); Class<?> rootClass = rootObj.getClass(); if (Class.class.equals(rootClass)) { rootClass = (Class<?>) rootObj; rootObj = null; } else { // If root object is an array, map or collection, add estimators as for fields if (rootClass.isArray() && !rootClass.getComponentType().isPrimitive()) { addArrayEstimator(byType, stack, null, rootObj); } else if (Collection.class.isAssignableFrom(rootClass)) { addCollectionEstimator(byType, stack, null, rootClass, rootObj); } else if (Map.class.isAssignableFrom(rootClass)) { addMapEstimator(byType, stack, null, rootClass, rootObj); } } addToProcessing(byType, stack, rootObj, rootClass); return stack; }
} else if (Collection.class.isAssignableFrom(fieldClass)) { estimator.addField(FieldType.COLLECTION, field); addCollectionEstimator(byType, stack, field, fieldClass, fieldObj); } else if (Map.class.isAssignableFrom(fieldClass)) { estimator.addField(FieldType.MAP, field);