code: public ResourceImpl getSubResource(String name, Object parameter) {
  
          SubResourceGetterModel getter =
                  resourceModel.getSubResourceGetter(name);
          if (getter == null) {
              throw new UnsupportedOperationException(
                      "No sub-resource named " + name);
          }
  
          Map<String, Object> ids = new HashMap<>();
  
          if (getter.getParameterMapping() != null) {
              ids.put(getter.getParameterMapping().getTarget(), parameter);
          }
  
          if (getter.getIdentifierMappings() != null) {
              for (FlatMapping mapping : getter.getIdentifierMappings()) {
                  Object value = identifiers.get(mapping.getSource());
                  if (value == null) {
                      throw new IllegalStateException(
                          "The " + name + " subresource model has a mapping "
                          + "for the " + mapping.getSource() + " identifier, but "
                          + "this resource doesn't have an identifier of that "
                          + "name!");
                  }
                  ids.put(mapping.getTarget(), value);
              }
          }
  
          ResourceModel refTypeModel = serviceModel.getResource(name);
  
          return new ResourceImpl(serviceModel, refTypeModel, client, ids);
      }
docs: Get a subresource of this resource by identifier, (optionally mapping
  in other identifiers of this resource).
  
  @param name the name of the subresource type
  @param parameter the parameter for this request
  @return the referenced subresource