org.hibernate.search.util.configuration.impl
Class MaskedProperty

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by org.hibernate.search.util.configuration.impl.MaskedProperty
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class MaskedProperty
extends Properties
implements Serializable

A wrapper to Properties, to restrict the availability of values to only those which have a key beginning with some masking String. Supported methods to enumerate the list of properties are: - propertyNames() - keySet() - keys() Other methods including methods returning Entries and values are not supported

Author:
Sanne Grinovero, Emmanuel Bernard
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
MaskedProperty(Properties propsToMask, String mask)
          Provides a view to the provided Properties hiding all keys not starting with some [mask.].
MaskedProperty(Properties propsToMask, String mask, Properties propsFallBack)
          Provides a view to the provided Properties hiding all keys not starting with some [mask.].
 
Method Summary
 void clear()
           
 Object clone()
           
 boolean contains(Object value)
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Enumeration<Object> elements()
           
 Set<Map.Entry<Object,Object>> entrySet()
           
 boolean equals(Object obj)
           
 Object get(Object key)
           
 String getProperty(String key)
           
 String getProperty(String key, String defaultValue)
           
 int hashCode()
           
 boolean isEmpty()
           
 Enumeration<Object> keys()
           
 Set<Object> keySet()
           
 void list(PrintStream out)
           
 void list(PrintWriter out)
           
 void load(InputStream inStream)
           
 void loadFromXML(InputStream in)
           
 Enumeration<?> propertyNames()
           
 Object put(Object key, Object value)
           
 void putAll(Map<? extends Object,? extends Object> t)
           
protected  void rehash()
           
 Object remove(Object key)
           
 void save(OutputStream out, String comments)
           
 Object setProperty(String key, String value)
           
 int size()
           
 void store(OutputStream out, String comments)
           
 void storeToXML(OutputStream os, String comment)
           
 void storeToXML(OutputStream os, String comment, String encoding)
           
 String toString()
           
 Collection<Object> values()
           
 
Methods inherited from class java.util.Properties
load, store, stringPropertyNames
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MaskedProperty

public MaskedProperty(Properties propsToMask,
                      String mask)
Provides a view to the provided Properties hiding all keys not starting with some [mask.].

Parameters:
propsToMask - the Properties containing the values.
mask -

MaskedProperty

public MaskedProperty(Properties propsToMask,
                      String mask,
                      Properties propsFallBack)
Provides a view to the provided Properties hiding all keys not starting with some [mask.]. If no value is found then a value is returned from propsFallBack, without masking.

Parameters:
propsToMask -
mask -
propsFallBack -
Method Detail

getProperty

public String getProperty(String key)
Overrides:
getProperty in class Properties

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<Object,Object>
Overrides:
containsKey in class Hashtable<Object,Object>
Throws:
IllegalArgumentException - if the key is not a String instance

getProperty

public String getProperty(String key,
                          String defaultValue)
Overrides:
getProperty in class Properties

list

public void list(PrintStream out)
Overrides:
list in class Properties
Throws:
UnsupportedOperationException

list

public void list(PrintWriter out)
Overrides:
list in class Properties
Throws:
UnsupportedOperationException

load

public void load(InputStream inStream)
          throws IOException
Overrides:
load in class Properties
Throws:
UnsupportedOperationException
IOException

loadFromXML

public void loadFromXML(InputStream in)
                 throws IOException,
                        InvalidPropertiesFormatException
Overrides:
loadFromXML in class Properties
Throws:
UnsupportedOperationException
IOException
InvalidPropertiesFormatException

propertyNames

public Enumeration<?> propertyNames()
Overrides:
propertyNames in class Properties

save

public void save(OutputStream out,
                 String comments)
Overrides:
save in class Properties
Throws:
UnsupportedOperationException

setProperty

public Object setProperty(String key,
                          String value)
Overrides:
setProperty in class Properties
Throws:
UnsupportedOperationException

store

public void store(OutputStream out,
                  String comments)
           throws IOException
Overrides:
store in class Properties
Throws:
UnsupportedOperationException
IOException

storeToXML

public void storeToXML(OutputStream os,
                       String comment,
                       String encoding)
                throws IOException
Overrides:
storeToXML in class Properties
Throws:
UnsupportedOperationException
IOException

storeToXML

public void storeToXML(OutputStream os,
                       String comment)
                throws IOException
Overrides:
storeToXML in class Properties
Throws:
UnsupportedOperationException
IOException

clear

public void clear()
Specified by:
clear in interface Map<Object,Object>
Overrides:
clear in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

clone

public Object clone()
Overrides:
clone in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

contains

public boolean contains(Object value)
Overrides:
contains in class Hashtable<Object,Object>

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<Object,Object>
Overrides:
containsValue in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

elements

public Enumeration<Object> elements()
Overrides:
elements in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

entrySet

public Set<Map.Entry<Object,Object>> entrySet()
Specified by:
entrySet in interface Map<Object,Object>
Overrides:
entrySet in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

get

public Object get(Object key)
Specified by:
get in interface Map<Object,Object>
Overrides:
get in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<Object,Object>
Overrides:
isEmpty in class Hashtable<Object,Object>

keys

public Enumeration<Object> keys()
Overrides:
keys in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

keySet

public Set<Object> keySet()
Specified by:
keySet in interface Map<Object,Object>
Overrides:
keySet in class Hashtable<Object,Object>

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map<Object,Object>
Overrides:
put in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

putAll

public void putAll(Map<? extends Object,? extends Object> t)
Specified by:
putAll in interface Map<Object,Object>
Overrides:
putAll in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

rehash

protected void rehash()
Overrides:
rehash in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

remove

public Object remove(Object key)
Specified by:
remove in interface Map<Object,Object>
Overrides:
remove in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

size

public int size()
Specified by:
size in interface Map<Object,Object>
Overrides:
size in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

toString

public String toString()
Overrides:
toString in class Hashtable<Object,Object>

values

public Collection<Object> values()
Specified by:
values in interface Map<Object,Object>
Overrides:
values in class Hashtable<Object,Object>
Throws:
UnsupportedOperationException

hashCode

public int hashCode()
Specified by:
hashCode in interface Map<Object,Object>
Overrides:
hashCode in class Hashtable<Object,Object>

equals

public boolean equals(Object obj)
Specified by:
equals in interface Map<Object,Object>
Overrides:
equals in class Hashtable<Object,Object>


Copyright © 2006-2012 Red Hat Middleware, LLC. All Rights Reserved