Package org.apache.openejb.util
Class SuperProperties
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<Object,
Object>
Properties is a Hashtable where the keys and values must be Strings. Each Properties can have a default
Properties which specifies the default values which are used if the key is not in this Properties.
- See Also:
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LinkedHashMap<String,
LinkedHashMap<String, String>> Attributes for the properties.protected boolean
Are lookups case insensitive?protected String
Number of spaces to indent comment after '#' character.protected LinkedHashMap<String,
String> Comments for individual the properties.protected Properties
The default property values.protected String
Number of spaces to indent each line of the properties file.protected String
The text between a key and the value.protected String
The line separator to use when storing.protected LinkedHashMap<Object,
Object> Actual property values.protected boolean
Should there be a blank line between a comment and the property.protected boolean
Should there be a blank line between properties. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new Properties object.SuperProperties
(Properties properties) Constructs a new Properties object using the specified default properties. -
Method Summary
Modifier and TypeMethodDescriptioncaseInsensitive
(boolean caseInsensitive) void
clear()
clone()
boolean
boolean
containsKey
(Object key) boolean
containsValue
(Object value) elements()
entrySet()
Returns an unmodifiable view of the entries.boolean
getAttributes
(String name) Searches for the attributes associated with the specified property.getComment
(String name) Searches for the comment associated with the specified property.int
Gets the number of spaces to indent comment after '#' character.int
Gets the number of spaces to indent each line of the properties file.Gets the text that separates keys and values.Gets the text that separates lines while storing.getProperty
(String name) getProperty
(String name, String defaultValue) int
hashCode()
boolean
Are lookups case insensitive?boolean
isEmpty()
boolean
Should there be a blank line between a comment and the property?boolean
Should a blank line be added between properties?keys()
keySet()
Returns an unmodifiable view of the keys.void
list
(PrintStream out) void
list
(PrintWriter writer) void
load
(InputStream in) void
Enumeration<?>
void
protected void
rehash()
void
save
(OutputStream out, String comment) void
setCaseInsensitive
(boolean caseInsensitive) Sets the sensitive of lookups.void
setComment
(String name, String comment) Sets the comment associated with a property.void
setCommentIndent
(int commentIndent) Sets the number of spaces to indent comment after '#' character.void
setIndent
(int indent) Sets the number of spaces to indent each line of the properties file.void
setKeyValueSeparator
(String keyValueSeparator) Sets the text that separates keys and values.void
setLineSeparator
(String lineSeparator) Sets the text that separates lines while storingsetProperty
(String name, String value) void
setSpaceAfterComment
(boolean spaceAfterComment) If true a blank line will be added between a comment and the property.void
setSpaceBetweenProperties
(boolean spaceBetweenProperties) If true a blank line will be added between properties.int
size()
void
store
(OutputStream out, String headComment) void
storeToXML
(OutputStream os, String comment) void
storeToXML
(OutputStream os, String headComment, String encoding) toString()
values()
Returns an unmodifiable view of the values.Methods inherited from class java.util.Properties
load, store, stringPropertyNames
Methods inherited from class java.util.Hashtable
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
properties
Actual property values. -
comments
Comments for individual the properties. -
attributes
Attributes for the properties. -
defaults
The default property values. -
caseInsensitive
protected boolean caseInsensitiveAre lookups case insensitive? -
keyValueSeparator
The text between a key and the value. -
lineSeparator
The line separator to use when storing. Defaults to system line separator. -
indent
Number of spaces to indent each line of the properties file. -
commentIndent
Number of spaces to indent comment after '#' character. -
spaceBetweenProperties
protected boolean spaceBetweenPropertiesShould there be a blank line between properties. -
spaceAfterComment
protected boolean spaceAfterCommentShould there be a blank line between a comment and the property.
-
-
Constructor Details
-
SuperProperties
public SuperProperties()Constructs a new Properties object. -
SuperProperties
Constructs a new Properties object using the specified default properties.- Parameters:
properties
- the default properties
-
-
Method Details
-
isCaseInsensitive
public boolean isCaseInsensitive()Are lookups case insensitive?- Returns:
- true if lookups are insensitive
-
setCaseInsensitive
public void setCaseInsensitive(boolean caseInsensitive) Sets the sensitive of lookups.- Parameters:
caseInsensitive
- if looks are insensitive
-
caseInsensitive
-
getKeyValueSeparator
Gets the text that separates keys and values. The default is "=".- Returns:
- the text that separates keys and values
-
setKeyValueSeparator
Sets the text that separates keys and values.- Parameters:
keyValueSeparator
- the text that separates keys and values
-
getLineSeparator
Gets the text that separates lines while storing. The default is the system line.separator.- Returns:
- the text that separates keys and values
-
setLineSeparator
Sets the text that separates lines while storing- Parameters:
lineSeparator
- the text that separates lines
-
getIndent
public int getIndent()Gets the number of spaces to indent each line of the properties file.- Returns:
- the number of spaces to indent each line of the properties file
-
setIndent
public void setIndent(int indent) Sets the number of spaces to indent each line of the properties file.- Parameters:
indent
- the number of spaces to indent each line of the properties file
-
getCommentIndent
public int getCommentIndent()Gets the number of spaces to indent comment after '#' character.- Returns:
- the number of spaces to indent comment after '#' character
-
setCommentIndent
public void setCommentIndent(int commentIndent) Sets the number of spaces to indent comment after '#' character.- Parameters:
commentIndent
- the number of spaces to indent comment after '#' character
-
isSpaceBetweenProperties
public boolean isSpaceBetweenProperties()Should a blank line be added between properties?- Returns:
- true if a blank line should be added between properties; false otherwise
-
setSpaceBetweenProperties
public void setSpaceBetweenProperties(boolean spaceBetweenProperties) If true a blank line will be added between properties.- Parameters:
spaceBetweenProperties
- if true a blank line will be added between properties
-
isSpaceAfterComment
public boolean isSpaceAfterComment()Should there be a blank line between a comment and the property?- Returns:
- true if a blank line should be added between a comment and the property
-
setSpaceAfterComment
public void setSpaceAfterComment(boolean spaceAfterComment) If true a blank line will be added between a comment and the property.- Parameters:
spaceAfterComment
- if true a blank line will be added between a comment and the property
-
getProperty
- Overrides:
getProperty
in classProperties
-
getProperty
- Overrides:
getProperty
in classProperties
-
setProperty
- Overrides:
setProperty
in classProperties
-
getComment
Searches for the comment associated with the specified property. If the property is not found, look in the default properties. If the property is not found in the default properties, answer null.- Parameters:
name
- the name of the property to find- Returns:
- the named property value
-
setComment
Sets the comment associated with a property.- Parameters:
name
- the property name; not nullcomment
- the comment; not null
-
getAttributes
Searches for the attributes associated with the specified property. If the property is not found, look in the default properties. If the property is not found in the default properties, answer null.- Parameters:
name
- the name of the property to find- Returns:
- the attributes for an existing property (not null); null for non-existant properties
-
list
- Overrides:
list
in classProperties
-
list
- Overrides:
list
in classProperties
-
load
- Overrides:
load
in classProperties
- Throws:
IOException
-
propertyNames
- Overrides:
propertyNames
in classProperties
-
save
- Overrides:
save
in classProperties
-
store
- Overrides:
store
in classProperties
- Throws:
IOException
-
loadFromXML
- Overrides:
loadFromXML
in classProperties
- Throws:
IOException
-
storeToXML
- Overrides:
storeToXML
in classProperties
- Throws:
IOException
-
storeToXML
- Overrides:
storeToXML
in classProperties
- Throws:
IOException
-
isEmpty
public boolean isEmpty() -
size
public int size() -
get
-
put
-
remove
-
putAll
-
keySet
Returns an unmodifiable view of the keys. -
keys
-
values
Returns an unmodifiable view of the values. -
entrySet
Returns an unmodifiable view of the entries. -
elements
-
containsKey
- Specified by:
containsKey
in interfaceMap<Object,
Object> - Overrides:
containsKey
in classHashtable<Object,
Object>
-
containsValue
- Specified by:
containsValue
in interfaceMap<Object,
Object> - Overrides:
containsValue
in classHashtable<Object,
Object>
-
contains
-
clear
public void clear() -
clone
-
equals
-
hashCode
public int hashCode() -
toString
-
rehash
protected void rehash()
-