2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.restconf.utils.parser.builder;
10 import com.google.common.base.CharMatcher;
11 import java.util.Arrays;
12 import org.opendaylight.restconf.parser.builder.YangInstanceIdentifierDeserializer;
13 import org.opendaylight.restconf.parser.builder.YangInstanceIdentifierSerializer;
16 * Util class of constants of {@link YangInstanceIdentifierSerializer} and
17 * {@link YangInstanceIdentifierDeserializer}.
19 * @deprecated move to splitted module restconf-nb-rfc8040
22 public final class ParserBuilderConstants {
24 private ParserBuilderConstants() {
25 throw new UnsupportedOperationException("Util class");
29 * Constants for {@link YangInstanceIdentifierSerializer}.
32 public static final class Serializer {
34 private Serializer() {
35 throw new UnsupportedOperationException("Util class");
38 public static final String DISABLED_CHARS = Arrays.toString(new char[] { ':', '/', '?', '#', '[', ']', '@' })
39 .concat(Arrays.toString(new char[] { '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=' }));
41 public static final CharMatcher PERCENT_ENCODE_CHARS = CharMatcher.anyOf(DISABLED_CHARS).precomputed();
45 * Constants for {@link YangInstanceIdentifierSerializer}.
48 public static final class Deserializer {
50 private Deserializer() {
51 throw new UnsupportedOperationException("Util class");
54 public static final CharMatcher BASE = CharMatcher.inRange('a', 'z').or(CharMatcher.inRange('A', 'Z'))
57 public static final CharMatcher IDENTIFIER_FIRST_CHAR = BASE.or(CharMatcher.is('_')).precomputed();
59 public static final CharMatcher IDENTIFIER = IDENTIFIER_FIRST_CHAR.or(CharMatcher.inRange('0', '9'))
60 .or(CharMatcher.anyOf(".-")).precomputed();
62 public static final CharMatcher IDENTIFIER_HEXA = CharMatcher.inRange('a', 'f')
63 .or(CharMatcher.inRange('A', 'F')).or(CharMatcher.inRange('0', '9')).precomputed();
65 public static final char COLON = ':';
66 public static final char EQUAL = '=';
67 public static final char COMMA = ',';
68 public static final char HYPHEN = '-';
69 public static final char PERCENT_ENCODING = '%';
71 public static final CharMatcher IDENTIFIER_PREDICATE = CharMatcher.noneOf(
72 Serializer.DISABLED_CHARS).precomputed();
74 public static final String EMPTY_STRING = "";
76 // position of the first encoded char after percent sign in percent encoded string
77 public static final int FIRST_ENCODED_CHAR = 1;
78 // position of the last encoded char after percent sign in percent encoded string
79 public static final int LAST_ENCODED_CHAR = 3;
80 // percent encoded radix for parsing integers
81 public static final int PERCENT_ENCODED_RADIX = 16;