code: private static ValueMap toValueMap(Resource resource) {
          ValueMap propertyMap = resource.adaptTo(ValueMap.class);
          if (propertyMap != null) {
              propertyMap = new PrimitiveSupportingValueMap(propertyMap);
          }
          return propertyMap;
      }
docs: Provides the properties of the resource as a {@link PrimitiveSupportingValueMap}.
  
  @param resource must not be <code>null</code>.
  @return the value map, or <code>null</code> if the resource has no properties,
  e.g. if it is synthetic.