eu.bitwalker.useragentutils.Browser.getId()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(312)

本文整理了Java中eu.bitwalker.useragentutils.Browser.getId()方法的一些代码示例,展示了Browser.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Browser.getId()方法的具体详情如下:
包路径:eu.bitwalker.useragentutils.Browser
类名称:Browser
方法名:getId

Browser.getId介绍

暂无

代码示例

代码示例来源:origin: HaraldWalker/user-agent-utils

public UserAgent(OperatingSystem operatingSystem, Browser browser)
{
  this.operatingSystem = operatingSystem;
  this.browser = browser;
  this.id = (( operatingSystem.getId() << 16) + browser.getId());
}

代码示例来源:origin: HaraldWalker/user-agent-utils

/**
 * Returns the enum constant of this type with the specified id.
 * Throws IllegalArgumentException if the value does not exist.
 * @param id Id of the browser
 * @return Browser enum
 */
public static Browser valueOf(short id)
{
  for (Browser browser : Browser.values())
  {
    if (browser.getId() == id)
      return browser;
  }
  // same behavior as standard valueOf(string) method
  throw new IllegalArgumentException(
      "No enum const for id " + id);
}

代码示例来源:origin: HaraldWalker/user-agent-utils

public UserAgent(String userAgentString)
{
  String userAgentLowercaseString = userAgentString == null ? null : userAgentString.toLowerCase();
  Browser browser = Browser.parseUserAgentLowercaseString(userAgentLowercaseString);
  OperatingSystem operatingSystem = OperatingSystem.UNKNOWN;
  // BOTs don't have an interesting OS for us
  if (browser != Browser.BOT)
    operatingSystem = OperatingSystem.parseUserAgentLowercaseString(userAgentLowercaseString);
  this.operatingSystem = operatingSystem;
  this.browser = browser;
  this.id = ((operatingSystem.getId() << 16) + browser.getId());
  this.userAgentString = userAgentString;
}

代码示例来源:origin: eu.bitwalker/UserAgentUtils

public UserAgent(OperatingSystem operatingSystem, Browser browser)
{
  this.operatingSystem = operatingSystem;
  this.browser = browser;
  this.id = (( operatingSystem.getId() << 16) + browser.getId());
}

代码示例来源:origin: eu.bitwalker/UserAgentUtils

/**
 * Returns the enum constant of this type with the specified id.
 * Throws IllegalArgumentException if the value does not exist.
 * @param id Id of the browser
 * @return Browser enum
 */
public static Browser valueOf(short id)
{
  for (Browser browser : Browser.values())
  {
    if (browser.getId() == id)
      return browser;
  }
  // same behavior as standard valueOf(string) method
  throw new IllegalArgumentException(
      "No enum const for id " + id);
}

代码示例来源:origin: eu.bitwalker/UserAgentUtils

public UserAgent(String userAgentString)
{
  String userAgentLowercaseString = userAgentString == null ? null : userAgentString.toLowerCase();
  Browser browser = Browser.parseUserAgentLowercaseString(userAgentLowercaseString);
  OperatingSystem operatingSystem = OperatingSystem.UNKNOWN;
  // BOTs don't have an interesting OS for us
  if (browser != Browser.BOT)
    operatingSystem = OperatingSystem.parseUserAgentLowercaseString(userAgentLowercaseString);
  this.operatingSystem = operatingSystem;
  this.browser = browser;
  this.id = ((operatingSystem.getId() << 16) + browser.getId());
  this.userAgentString = userAgentString;
}

代码示例来源:origin: stackoverflow.com

public class BrowserTest{

  @Test
  public void testNoArgsConstructor(){
    Browser testedBrowser = new Browser();
    assertNull(testedBrowser.getWineCase());
    assertNull(testedBrowser.getWebsite());
    assertEquals(00065, testedBrowser.getId());
    assertEquals(1992, testedBrowser.getYearOfBirth());
    assertTrue(testedBrowser.getMemberId());
    assertFalse(testedBrowser.isDiscount());
  }

//more tests
}

相关文章