Package com.iizix.selector
Class DeviceMatcher
java.lang.Object
com.iizix.selector.DeviceMatcher
Class that loads an external XML file for device matching.
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
- Matching topic is defined as:{topic name="nnn"} ...devices... {/topic}
- Device tag as:{device name="nnn"} ...match... {/device}
- Verification can be combined with "or" or "and":{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}
- String matching:
 {string id="nnn" match="string" type="type" [case="false"] [negate="true"]/}
 where type is "equals", "in" (like indexOf or contains), "wild" or "regexp".
 case="false" means case insensitive match.
- Value matching
 {value id="nnn" [min="value"] [max="value"] [negate="true"]/}.
- Negation of match
 [negate="true"] on any tag means that the match is negated (boolean NOT).
- Author:
- Christopher Mindus
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- static DeviceMatcherGets the singleton.- booleanVerifies that a topic is present.- boolean- isMatching- (String topic, IInfoProvider info) Matches a topic.
- Constructor Details- DeviceMatcherpublic DeviceMatcher()Constructs the device matcher.
 
- Method Details- getInstanceGets the singleton.
- hasTopicVerifies that a topic is present.- Parameters:
- topic- The topic name.
- Returns:
- true if topic is present in the DeviceMatcher.xml file.
 
- isMatchingMatches a topic. A severe error is logged if the topic is not found.- Parameters:
- topic- The topic name.
- info- The information provider.
- Returns:
- The match flag.