Debian Codegraph @

src/test/java/ezvcard/io/scribe/CannotParseScribe.java

raw symbols SCIP
1 package ezvcard.io.scribe;
2
3 import ezvcard.VCardDataType;
4 import ezvcard.VCardVersion;
5 import ezvcard.io.CannotParseException;
6 import ezvcard.io.ParseContext;
7 import ezvcard.io.html.HCardElement;
8 import ezvcard.io.json.JCardValue;
9 import ezvcard.io.text.WriteContext;
10 import ezvcard.io.xml.XCardElement;
11 import ezvcard.parameter.VCardParameters;
12 import ezvcard.property.CannotParseProperty;
13
14 /*
15 Copyright (c) 2012-2023, Michael Angstadt
16 All rights reserved.
17
18 Redistribution and use in source and binary forms, with or without
19 modification, are permitted provided that the following conditions are met:
20
21 1. Redistributions of source code must retain the above copyright notice, this
22 list of conditions and the following disclaimer.
23 2. Redistributions in binary form must reproduce the above copyright notice,
24 this list of conditions and the following disclaimer in the documentation
25 and/or other materials provided with the distribution.
26
27 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
28 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
31 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
34 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
38 The views and conclusions contained in the software and documentation are those
39 of the authors and should not be interpreted as representing official policies,
40 either expressed or implied, of the FreeBSD Project.
41 */
42
43 /**
44 * A scribe that always throws a {@link CannotParseException}.
45 * @author Michael Angstadt
46 */
47 public class CannotParseScribe extends VCardPropertyScribe<CannotParseProperty> {
48 public CannotParseScribe() {
49 super(CannotParseProperty.class, "CANNOTPARSE");
50 }
51
52 @Override
53 protected VCardDataType _defaultDataType(VCardVersion version) {
54 return null;
55 }
56
57 @Override
58 protected String _writeText(CannotParseProperty property, WriteContext context) {
59 return "value";
60 }
61
62 @Override
63 protected CannotParseProperty _parseText(String value, VCardDataType dataType, VCardParameters parameters, ParseContext context) {
64 throw new CannotParseException();
65 }
66
67 @Override
68 protected CannotParseProperty _parseXml(XCardElement element, VCardParameters parameters, ParseContext context) {
69 throw new CannotParseException();
70 }
71
72 @Override
73 protected CannotParseProperty _parseHtml(HCardElement element, ParseContext context) {
74 throw new CannotParseException();
75 }
76
77 @Override
78 protected CannotParseProperty _parseJson(JCardValue value, VCardDataType dataType, VCardParameters parameters, ParseContext context) {
79 throw new CannotParseException();
80 }
81 }