View Javadoc
1   /*
2    * Copyright 2015 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.handler.codec;
17  
18  /**
19   * {@link UnsupportedOperationException} will be thrown from all {@link ValueConverter} methods.
20   */
21  public final class UnsupportedValueConverter<V> implements ValueConverter<V> {
22      @SuppressWarnings("rawtypes")
23      private static final UnsupportedValueConverter INSTANCE = new UnsupportedValueConverter();
24      private UnsupportedValueConverter() { }
25  
26      @SuppressWarnings("unchecked")
27      public static <V> UnsupportedValueConverter<V> instance() {
28          return (UnsupportedValueConverter<V>) INSTANCE;
29      }
30  
31      @Override
32      public V convertObject(Object value) {
33          throw new UnsupportedOperationException();
34      }
35  
36      @Override
37      public V convertBoolean(boolean value) {
38          throw new UnsupportedOperationException();
39      }
40  
41      @Override
42      public boolean convertToBoolean(V value) {
43          throw new UnsupportedOperationException();
44      }
45  
46      @Override
47      public V convertByte(byte value) {
48          throw new UnsupportedOperationException();
49      }
50  
51      @Override
52      public byte convertToByte(V value) {
53          throw new UnsupportedOperationException();
54      }
55  
56      @Override
57      public V convertChar(char value) {
58          throw new UnsupportedOperationException();
59      }
60  
61      @Override
62      public char convertToChar(V value) {
63          throw new UnsupportedOperationException();
64      }
65  
66      @Override
67      public V convertShort(short value) {
68          throw new UnsupportedOperationException();
69      }
70  
71      @Override
72      public short convertToShort(V value) {
73          throw new UnsupportedOperationException();
74      }
75  
76      @Override
77      public V convertInt(int value) {
78          throw new UnsupportedOperationException();
79      }
80  
81      @Override
82      public int convertToInt(V value) {
83          throw new UnsupportedOperationException();
84      }
85  
86      @Override
87      public V convertLong(long value) {
88          throw new UnsupportedOperationException();
89      }
90  
91      @Override
92      public long convertToLong(V value) {
93          throw new UnsupportedOperationException();
94      }
95  
96      @Override
97      public V convertTimeMillis(long value) {
98          throw new UnsupportedOperationException();
99      }
100 
101     @Override
102     public long convertToTimeMillis(V value) {
103         throw new UnsupportedOperationException();
104     }
105 
106     @Override
107     public V convertFloat(float value) {
108         throw new UnsupportedOperationException();
109     }
110 
111     @Override
112     public float convertToFloat(V value) {
113         throw new UnsupportedOperationException();
114     }
115 
116     @Override
117     public V convertDouble(double value) {
118         throw new UnsupportedOperationException();
119     }
120 
121     @Override
122     public double convertToDouble(V value) {
123         throw new UnsupportedOperationException();
124     }
125 }