class ResourceInformationReflector {

	@VisibleForTesting
	Map<String, Long> getAllResourceInfos(Object resource) {
		if (!isYarnResourceTypesAvailable) {
			return Collections.emptyMap();
		}

		final Map<String, Long> externalResources = new HashMap<>();
		final Object[] externalResourcesInfo;
		try {
			externalResourcesInfo = (Object[]) resourceGetResourcesMethod.invoke(resource);
			for (int i = 0; i < externalResourcesInfo.length; i++) {
				final String name = (String) resourceInformationGetNameMethod.invoke(externalResourcesInfo[i]);
				final long value = (long) resourceInformationGetValueMethod.invoke(externalResourcesInfo[i]);
				externalResources.put(name, value);
			}
		} catch (Exception e) {
			LOG.warn("Could not obtain the external resources supported by the given Resource.", e);
			return Collections.emptyMap();
		}
		return externalResources;
	}

	private  ResourceInformationReflector();
	@VisibleForTesting  ResourceInformationReflector(String resourceClassName, String resourceInfoClassName);

}