protected void updateApiVersion(HasMetadata hasMetadata) {
    String version = getApiVersion();
    if (hasMetadata != null && version != null && version.length() > 0) {
      String current = hasMetadata.getApiVersion();
      // lets overwrite the api version if its currently missing, the resource uses an API Group with '/'
      // or we have the default of 'v1' when using an API group version like 'build.openshift.io/v1'
      if (current == null || "v1".equals(current) || current.indexOf('/') < 0 && version.indexOf('/') > 0) {
        hasMetadata.setApiVersion(version);
      }
    }
  }
protected void updateApiVersion ( HasMetadata hasMetadata ) { String version = getApiVersion ( ) ; if ( hasMetadata != null && version != null && version . length ( ) > 0 ) { String current = hasMetadata . getApiVersion ( ) ; if ( current == null || "v1" . equals ( current ) || current . indexOf ( '/' ) < 0 && version . indexOf ( '/' ) > 0 ) { hasMetadata . setApiVersion ( version ) ; } } }
Updates the resource if it has missing or default apiGroupVersion values and the resource is currently
using API Groups with custom version strings

@param hasMetadata object whose api version needs to be updated