Module bus.http

Class Device

java.lang.Object
org.miaixz.bus.http.metric.anget.UserAgent
org.miaixz.bus.http.metric.anget.Device

public class Device extends UserAgent
Represents a device type, such as a phone, tablet, or desktop, parsed from a User-Agent string.
Since:
Java 17+
Author:
Kimi Liu
  • Field Details

    • UNKNOWN

      public static final Device UNKNOWN
      Represents an unknown device.
    • IPHONE

      public static final Device IPHONE
      Represents an iPhone device.
    • IPOD

      public static final Device IPOD
      Represents an iPod device.
    • IPAD

      public static final Device IPAD
      Represents an iPad device.
    • ANDROID

      public static final Device ANDROID
      Represents an Android device.
    • HARMONY

      public static final Device HARMONY
      Represents a HarmonyOS device.
    • GOOGLE_TV

      public static final Device GOOGLE_TV
      Represents a Google TV device.
    • WINDOWS_PHONE

      public static final Device WINDOWS_PHONE
      Represents a Windows Phone device.
    • MOBILE_DEVICE

      public static final List<Device> MOBILE_DEVICE
      A list of supported mobile device types.
    • DESKTOP_DEVICE

      public static final List<Device> DESKTOP_DEVICE
      A list of supported desktop device types.
    • ALL_DEVICE

      public static final List<Device> ALL_DEVICE
      A combined list of all supported device types.
  • Constructor Details

    • Device

      public Device(String name, String rule)
      Constructs a new Device instance.
      Parameters:
      name - The name of the device.
      rule - The keyword or expression to match in the User-Agent string.
  • Method Details

    • isMobile

      public boolean isMobile()
      Returns whether this device is a mobile device.
      Returns:
      true if this is a mobile device, false otherwise.
    • isIPhoneOrIPod

      public boolean isIPhoneOrIPod()
      Returns whether this device is an iPhone or iPod.
      Returns:
      true if this is an iPhone or iPod, false otherwise.
    • isIPad

      public boolean isIPad()
      Returns whether this device is an iPad.
      Returns:
      true if this is an iPad, false otherwise.
    • isIos

      public boolean isIos()
      Returns whether this device is an iOS device (iPhone, iPod, or iPad).
      Returns:
      true if this is an iOS device, false otherwise.
    • isAndroid

      public boolean isAndroid()
      Returns whether this device is an Android device (including Google TV).
      Returns:
      true if this is an Android device, false otherwise.
    • isHarmony

      public boolean isHarmony()
      Returns whether this device is a HarmonyOS device.
      Returns:
      true if this is a HarmonyOS device, false otherwise.