1 5 package com.tc.properties; 6 7 import java.util.Properties ; 8 9 class TCSubProperties implements TCProperties { 10 11 private final String category; 12 private final TCPropertiesImpl properties; 13 14 public TCSubProperties(TCPropertiesImpl properties, String category) { 15 this.properties = properties; 16 this.category = category; 17 } 18 19 public TCProperties getPropertiesFor(String category2) { 20 return properties.getPropertiesFor(getActualKey(category2)); 21 } 22 23 private String getActualKey(String key) { 24 return category + "." + key; 25 } 26 27 protected boolean containsKey(String key) { 29 return key.startsWith(category + "."); 30 } 31 32 public String getProperty(String key) { 33 return properties.getProperty(getActualKey(key)); 34 } 35 36 public String toString() { 37 return "TCSubProperties(" + category + ")"; 38 } 39 40 public Properties addAllPropertiesTo(Properties dest) { 41 return properties.addAllPropertiesTo(dest, category + "."); 42 } 43 44 public boolean getBoolean(String key) { 45 return properties.getBoolean(getActualKey(key)); 46 } 47 48 public float getFloat(String key) { 49 return properties.getFloat(getActualKey(key)); 50 } 51 52 public int getInt(String key) { 53 return properties.getInt(getActualKey(key)); 54 } 55 56 public long getLong(String key) { 57 return properties.getLong(getActualKey(key)); 58 } 59 60 public String getProperty(String key, boolean missingOkay) { 61 return properties.getProperty(getActualKey(key), missingOkay); 62 } 63 } 64 | Popular Tags |