code: public static <T extends Resource>  T withDefaultType( T resource, Type defaultType)
      {
      if( resource.getType() == null)
        {
        resource.setType( defaultType);
        }
  
      return resource;
      }
docs: Returns the given resource, assigning the default type if no type yet defined.