All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zendesk.client.v2.DefaultUserAgent Maven / Gradle / Ivy

The newest version!
package org.zendesk.client.v2;

import java.util.regex.Pattern;

public class DefaultUserAgent {
  private static final Pattern VERSION_PATTERN = Pattern.compile("[\\w-.]+");
  private final String userAgent;

  public DefaultUserAgent() {
    this(DefaultUserAgent.class.getPackage().getImplementationVersion());
  }

  public DefaultUserAgent(String version) {
    StringBuilder sb = new StringBuilder("zendesk-java-client");
    if (version != null && VERSION_PATTERN.matcher(version).matches()) {
      sb.append('/').append(version);
    }
    this.userAgent = sb.toString();
  }

  public String toString() {
    return this.userAgent;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy