Coverage Report - org.ini4j.Registry
 
Classes in this File Line Coverage Branch Coverage Complexity
Registry
N/A
N/A
1
Registry$Hive
100%
6/6
N/A
1
Registry$Key
N/A
N/A
1
Registry$Type
100%
23/23
N/A
1
 
 1  
 /*
 2  
  * Copyright 2005,2009 Ivan SZKIBA
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * 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,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.ini4j;
 17  
 
 18  
 import java.nio.charset.Charset;
 19  
 
 20  
 import java.util.HashMap;
 21  
 import java.util.Map;
 22  
 
 23  
 public interface Registry extends Profile
 24  
 {
 25  6
     enum Hive
 26  
     {
 27  1
         HKEY_CLASSES_ROOT,
 28  1
         HKEY_CURRENT_CONFIG,
 29  1
         HKEY_CURRENT_USER,
 30  1
         HKEY_LOCAL_MACHINE,
 31  1
         HKEY_USERS;
 32  
     }
 33  
 
 34  
     // TODO handle delete operations with special Type
 35  3
     enum Type
 36  
     {
 37  1
         REG_NONE("hex(0)"),
 38  1
         REG_SZ(""),
 39  1
         REG_EXPAND_SZ("hex(2)"),
 40  1
         REG_BINARY("hex"),
 41  1
         REG_DWORD("dword"),
 42  1
         REG_DWORD_BIG_ENDIAN("hex(5)"),
 43  1
         REG_LINK("hex(6)"),
 44  1
         REG_MULTI_SZ("hex(7)"),
 45  1
         REG_RESOURCE_LIST("hex(8)"),
 46  1
         REG_FULL_RESOURCE_DESCRIPTOR("hex(9)"),
 47  1
         REG_RESOURCE_REQUIREMENTS_LIST("hex(a)"),
 48  1
         REG_QWORD("hex(b)");
 49  
         private static final Map<String, Type> MAPPING;
 50  
 
 51  
         static
 52  
         {
 53  1
             MAPPING = new HashMap<String, Type>();
 54  13
             for (Type t : values())
 55  
             {
 56  12
                 MAPPING.put(t.toString(), t);
 57  
             }
 58  
         }
 59  
 
 60  
         public static final char SEPARATOR_CHAR = ':';
 61  1
         public static final String SEPARATOR = String.valueOf(SEPARATOR_CHAR);
 62  
         public static final char REMOVE_CHAR = '-';
 63  1
         public static final String REMOVE = String.valueOf(REMOVE_CHAR);
 64  
         private final String _prefix;
 65  
 
 66  
         private Type(String prefix)
 67  12
         {
 68  12
             _prefix = prefix;
 69  12
         }
 70  
 
 71  
         public static Type fromString(String str)
 72  
         {
 73  175
             return MAPPING.get(str);
 74  
         }
 75  
 
 76  
         @Override public String toString()
 77  
         {
 78  209
             return _prefix;
 79  
         }
 80  
     }
 81  
 
 82  
     char ESCAPE_CHAR = '\\';
 83  
     Charset FILE_ENCODING = Charset.forName("UnicodeLittle");
 84  
     char KEY_SEPARATOR = '\\';
 85  
     String LINE_SEPARATOR = "\r\n";
 86  
     char TYPE_SEPARATOR = ':';
 87  
     String VERSION = "Windows Registry Editor Version 5.00";
 88  
 
 89  
     String getVersion();
 90  
 
 91  
     void setVersion(String value);
 92  
 
 93  
     @Override Key get(Object key);
 94  
 
 95  
     @Override Key get(Object key, int index);
 96  
 
 97  
     @Override Key put(String key, Section value);
 98  
 
 99  
     @Override Key put(String key, Section value, int index);
 100  
 
 101  
     @Override Key remove(Object key);
 102  
 
 103  
     @Override Key remove(Object key, int index);
 104  
 
 105  
     interface Key extends Section
 106  
     {
 107  
         String DEFAULT_NAME = "@";
 108  
 
 109  
         @Override Key getChild(String key);
 110  
 
 111  
         @Override Key getParent();
 112  
 
 113  
         Type getType(Object key);
 114  
 
 115  
         Type getType(Object key, Type defaulType);
 116  
 
 117  
         @Override Key addChild(String key);
 118  
 
 119  
         @Override Key lookup(String... path);
 120  
 
 121  
         Type putType(String key, Type type);
 122  
 
 123  
         Type removeType(Object key);
 124  
     }
 125  
 }