blob: 0287ccaeb6cf8e873e19e51403fe9bcdf2895e94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
* Copyright (c) 2012 Isode Limited, London, England.
* All rights reserved.
*/
/*
* Copyright (c) 2010 Remko Tronçon
* All rights reserved.
*/
package com.isode.stroke.parser.payloadparsers;
import com.isode.stroke.elements.Form;
import com.isode.stroke.parser.AttributeMap;
import com.isode.stroke.parser.PayloadParser;
import com.isode.stroke.parser.PayloadParserFactory;
/**
* Parser factory for {@link Form} element.
*/
public class FormParserFactory implements PayloadParserFactory {
/**
* Constructor
*/
public FormParserFactory() {
}
public boolean canParse(String element, String ns,
final AttributeMap attributes) {
if (element == null) {
throw new NullPointerException("'element' must not be null");
}
if (ns == null) {
throw new NullPointerException("'ns' must not be null");
}
if (attributes == null) {
throw new NullPointerException("'attributes' must not be null");
}
return ns.equals("jabber:x:data");
}
public PayloadParser createPayloadParser() {
return new FormParser();
}
@Override
public String toString() {
return FormParserFactory.class.getSimpleName();
}
}
|