View Javadoc

1   package org.apache.onami.configuration;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.Map.Entry;
23  
24  /**
25   * A simple {@code Entry<String, String>} implementation.
26   */
27  final class KeyValue
28      implements Entry<String, String>
29  {
30  
31      /**
32       * The entry key.
33       */
34      private final String key;
35  
36      /**
37       * The entry value.
38       */
39      private final String value;
40  
41      /**
42       * Creates a new {@code Entry<String, String>}.
43       *
44       * @param key the entry key.
45       * @param value the entry value.
46       */
47      public KeyValue( String key, String value )
48      {
49          this.key = key;
50          this.value = value;
51      }
52  
53      /**
54       * {@inheritDoc}
55       */
56      public String getKey()
57      {
58          return key;
59      }
60  
61      /**
62       * {@inheritDoc}
63       */
64      public String getValue()
65      {
66          return value;
67      }
68  
69      /**
70       * {@inheritDoc}
71       */
72      public String setValue( String value )
73      {
74          throw new UnsupportedOperationException( "Value is read-only in this version" );
75      }
76  
77  }