java.lang.Object
org.miaixz.bus.http.metric.anget.UserAgent
org.miaixz.bus.http.metric.anget.Device
Represents a device type, such as a phone, tablet, or desktop, parsed from a User-Agent string.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
FieldsModifier and TypeFieldDescriptionA combined list of all supported device types.static final DeviceRepresents an Android device.A list of supported desktop device types.static final DeviceRepresents a Google TV device.static final DeviceRepresents a HarmonyOS device.static final DeviceRepresents an iPad device.static final DeviceRepresents an iPhone device.static final DeviceRepresents an iPod device.A list of supported mobile device types.static final DeviceRepresents an unknown device.static final DeviceRepresents a Windows Phone device. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether this device is an Android device (including Google TV).booleanReturns whether this device is a HarmonyOS device.booleanisIos()Returns whether this device is an iOS device (iPhone, iPod, or iPad).booleanisIPad()Returns whether this device is an iPad.booleanReturns whether this device is an iPhone or iPod.booleanisMobile()Returns whether this device is a mobile device.
-
Field Details
-
UNKNOWN
Represents an unknown device. -
IPHONE
Represents an iPhone device. -
IPOD
Represents an iPod device. -
IPAD
Represents an iPad device. -
ANDROID
Represents an Android device. -
HARMONY
Represents a HarmonyOS device. -
GOOGLE_TV
Represents a Google TV device. -
WINDOWS_PHONE
Represents a Windows Phone device. -
MOBILE_DEVICE
A list of supported mobile device types. -
DESKTOP_DEVICE
A list of supported desktop device types. -
ALL_DEVICE
A combined list of all supported device types.
-
-
Constructor Details
-
Device
Constructs a newDeviceinstance.- 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:
trueif this is a mobile device,falseotherwise.
-
isIPhoneOrIPod
public boolean isIPhoneOrIPod()Returns whether this device is an iPhone or iPod.- Returns:
trueif this is an iPhone or iPod,falseotherwise.
-
isIPad
public boolean isIPad()Returns whether this device is an iPad.- Returns:
trueif this is an iPad,falseotherwise.
-
isIos
public boolean isIos()Returns whether this device is an iOS device (iPhone, iPod, or iPad).- Returns:
trueif this is an iOS device,falseotherwise.
-
isAndroid
public boolean isAndroid()Returns whether this device is an Android device (including Google TV).- Returns:
trueif this is an Android device,falseotherwise.
-
isHarmony
public boolean isHarmony()Returns whether this device is a HarmonyOS device.- Returns:
trueif this is a HarmonyOS device,falseotherwise.
-