public class DeviceMatcher extends Object
The matching is done on one or more of:
id origin description -------- ------------------------- ----------------------------- ua env: navigator.userAgent User agent pua/os.family env: navigator.userAgent User agent (os.family: parsed with ua-parser) pua/os.major env: navigator.userAgent User agent (os.major: parsed with ua-parser) ptf: env: navigator.platform Platform dd: env: device.diagonal Device size sw: env: screen.width Screen width sh: env: screen.height Screen height saw: env: screen.availableWidth Screen available width sah: env: screen.availableHeight Screen available height cap: capability: name Capability name
{topic name="nnn"} ...devices... {/topic}
{device name="nnn"} ...match... {/device}
{or [negate="true"]} {and [negate="true"]} {string id="nnn" match="iPad" type="equals"/} {value id="mmm" min="100" max="200"/} {/and} {value id="abc" min="10" max="20"/} {/or}
Constructor and Description |
---|
DeviceMatcher()
Constructs the device matcher.
|
Modifier and Type | Method and Description |
---|---|
static DeviceMatcher |
getInstance()
Gets the singleton.
|
boolean |
hasTopic(String topic)
Verifies that a topic is present.
|
boolean |
isMatching(String topic,
IInfoProvider info)
Matches a topic.
|
void |
loadFile(URL url)
Opens the XML file and loads topics from it.
|
public static DeviceMatcher getInstance()
public void loadFile(URL url) throws IOException, SAXException
url
- The file to load.SAXException
- For parser errors.IOException
- For I/O exception or if XML file is in wrong format.public boolean hasTopic(String topic)
topic
- The topic name.public boolean isMatching(String topic, IInfoProvider info)
topic
- The topic name.info
- The information provider.iizi® is a registered trademark of Mindus SARL. © Copyright Mindus SARL, 2020. All rights reserved.