Package com.iizix.selector
Class DeviceMatch
java.lang.Object
com.iizix.selector.DeviceMatch
Matches devices for Selectors.
- Author:
- Christopher Mindus
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- static booleanChecks if the match string exists.- static String- getDescription- (String match) Gets the device description for a string.- static io.github.mngsk.devicedetector.DetectionGets the cached device detection instance based on the parsed user agent.- static StringGets the Operating System from the cached device detection instance based on the parsed user agent.- getMap()Gets the map of devices that can match with this class.- static ua_parser.ClientGets the parsed user agent instance.- static String- getSelectorMatch- (String userAgent) Generate output for a User Agent with every possible selector match.- static String- getUserAgent- (EnvProps env) Gets client "User Agent" string.- static booleanCheck for Android device (phone or tablet).- static booleanDeprecated.- static booleanCheck for iOS device (iPhone or iPad).- static booleanCheck for Mac OS device.- static boolean- isWinPhone- (EnvProps env) Check for Windows Phone.- static booleanMatches a device.
- Constructor Details- DeviceMatchpublic DeviceMatch()
 
- Method Details- matchMatches a device.- Parameters:
- envProps- The Client environment properties.
- match- The match string.
- Returns:
- true for match, false otherwise.
 
- getDescriptionGets the device description for a string. This method is typically used in the Designer.- Parameters:
- match- The match string.
- Returns:
- The description of the device matching, null for none.
 
- existsChecks if the match string exists.- Parameters:
- match- The match string.
- Returns:
- true if it exists, false otherwise.
 
- getMapGets the map of devices that can match with this class.- Returns:
- An unmodifiable map with the string match as keys and descriptions as values.
 
- getUserAgentGets client "User Agent" string.- Parameters:
- env- The environment for a client.
- Returns:
- The user agent string.
- Throws:
- Exception- An exception due to failure in performing the test, with a message why it failed.
 
- getParsedUserAgentGets the parsed user agent instance.- Parameters:
- env- The environment for a client.
- Returns:
- The parsed user agent for the client, a cached value (i.e. parsed once only).
- Throws:
- Exception- An exception due to failure in performing the test, with a message why it failed.
 
- getDeviceDetectionFromUserAgentpublic static io.github.mngsk.devicedetector.Detection getDeviceDetectionFromUserAgent- (EnvProps env) throws Exception Gets the cached device detection instance based on the parsed user agent.- Parameters:
- env- The environment for a client.
- Returns:
- The cached device detection instance based on the parsed user agent (i.e. parsed once only).
- Throws:
- Exception- An exception due to failure in performing the test, with a message why it failed.
 
- getDeviceDetectionOperatingSystemFromUserAgentGets the Operating System from the cached device detection instance based on the parsed user agent.- Parameters:
- env- The environment for a client.
- Returns:
- The OS.
- Throws:
- Exception- An exception due to failure in performing the test, with a message why it failed.
 
- isiOSCheck for iOS device (iPhone or iPad).- Parameters:
- env- Environment properties
- Returns:
- true if the environment properties indicate a iOS device
- Throws:
- Exception- An exception due to failure in performing the test, with a message why it failed.
 
- isAndroidCheck for Android device (phone or tablet).- Parameters:
- env- Environment properties.
- Returns:
- true if the environment properties indicate a Android device.
- Throws:
- Exception- An exception due to failure in performing the test, with a message why it failed.
 
- isWinPhoneCheck for Windows Phone.- Parameters:
- env- Environment properties.
- Returns:
- true if the environment properties indicate a Windows Phone.
- Throws:
- Exception- An exception due to failure in performing the test, with a message why it failed.
 
- isMacCheck for Mac OS device.- Parameters:
- env- Environment properties.
- Returns:
- true if the environment properties indicate a Mac device.
- Throws:
- Exception- An exception due to failure in performing the test, with a message why it failed.
 
- isDesktopDeprecated.Use the method- {@link #getDeviceDetectionFromUserAgent(EnvProps)}.isDesktop()instead.Check for desktop device.- This method returns the value from - {@link #getDeviceDetectionFromUserAgent(EnvProps)}.isDesktop().- Parameters:
- env- Environment properties
- Returns:
- true if the environment properties indicate a desktop device
- Throws:
- Exception- An exception due to failure in performing the test, with a message why it failed.
 
- getSelectorMatchGenerate output for a User Agent with every possible selector match. OS and device information is also appended. New lines separate entries.- Parameters:
- userAgent- The user agent string.
- Returns:
- The formatted string.
 
 
{@link #getDeviceDetectionFromUserAgent(EnvProps)}.isDesktop()instead.