code: public <T> void setUsermetaData(RiakUserMetadata userMetadata, T obj)
      {
          Field mapField = null;
          for (UsermetaField uf : usermetaFields)
          {
              switch (uf.getFieldType())
              {
                  case STRING:
                      if (userMetadata.containsKey(uf.getUsermetaDataKey()))
                      {
                          setFieldValue(uf.getField(), obj, userMetadata.get(uf.getUsermetaDataKey()));
                          userMetadata.remove(uf.getUsermetaDataKey());
                      }
                      break;
                  case MAP:
                      mapField = uf.getField();
                      break;
                  default:
                      break;
              }
          }
  
          Method mapSetter = null;
          for (UsermetaMethod um : usermetaMethods)
          {
              switch (um.getMethodType())
              {
                  case STRING_SETTER:
                      if (userMetadata.containsKey(um.getUsermetaDataKey()))
                      {
                          setMethodValue(um.getMethod(), obj, userMetadata.get(um.getUsermetaDataKey()));
                          userMetadata.remove(um.getUsermetaDataKey());
                      }
                      break;
                  case MAP_SETTER:
                      mapSetter = um.getMethod();
                      break;
                  default:
                      break;
              }
          }
  
          if (mapSetter != null || mapField != null)
          {
              Map<String,String> mapCopy = new HashMap<>(userMetadata.size());
              for (Map.Entry<BinaryValue,BinaryValue> entry : userMetadata.getUserMetadata())
              {
                  mapCopy.put(entry.getKey().toString(), entry.getValue().toString());
              }
  
              if (mapSetter != null)
              {
                  setMethodValue(mapSetter, obj, mapCopy);
              }
  
              if (mapField != null)
              {
                  setFieldValue(mapField, obj, mapCopy);
              }
          }
      }
docs: Populates an @RiakUsermeta annotated domain object with the User metadata.
  @param <T>
  @param userMetadata
  @param obj