Package org.tmatesoft.svn.core
Class SVNProperties
java.lang.Object
org.tmatesoft.svn.core.SVNProperties
- All Implemented Interfaces:
Serializable
,Cloneable
The SVNProperties class represents an object wrapper for
String
to SVNPropertyValue
mappings where
String
keys represent property names and values - property
values wrapped in SVNPropertyValue
objects.
This class is backed by a Map
object and brings specific methods
useful for working with version controlled properties.
Objects of this type are modifiable.
- Since:
- 1.2
- Version:
- 1.3
- Author:
- TMate Software Ltd.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an emptySVNProperties
object.SVNProperties
(SVNProperties properties) Creates a newSVNProperties
object copying the given one. -
Method Summary
Modifier and TypeMethodDescriptionasMap()
Returns SVNProperties as Map of String, SVNPropertyValue pairs.void
clear()
Removes all properties from this object.clone()
Creates and returns a copy of this object.compareTo
(SVNProperties properties) Compares this object against another one returning a difference between them.boolean
containsName
(String propertyName) Tells whether this properties object contains the specified property name.boolean
containsValue
(SVNPropertyValue value) Tells whether this properties object contains the specified property value.void
dispose()
boolean
Tells whether this object andobj
are equal.byte[]
getBinaryValue
(String propertyName) Returns a binary property value.Returns a subset of properties contained in this properties object which suffice forSVNProperty.isRegularProperty(String)
clause.getStringValue
(String propertyName) Returns aString
property value.getSVNPropertyValue
(String propertyName) Returns a property value as anSVNPropertyValue
.int
hashCode()
Returns a hash code of this object.boolean
isEmpty()
Tells if this properties object holds no properties (empty).nameSet()
Returns a set of property names contained by this object.void
Stores a new property name-to-value mapping in this object.void
Stores a new property name-to-value mapping in this object.void
Stores a new property name-to-value mapping in this object.void
put
(String propertyName, SVNPropertyValue propertyValue) Stores a new mappingpropertyName
topropertyValue
in this object.void
putAll
(SVNProperties properties) Puts all properties from the specified properties object to this object.Removes the specified property from this properties object.void
Removes all mappings which values are nulls from this object.int
size()
Returns the number of properties held by this object.toString()
static SVNProperties
unmodifiableProperties
(SVNProperties properties) Returns an unmodifiable view of the specifiedproperties
.values()
Returns a collection of property values contained in this properties object.static SVNProperties
Creates a newSVNProperties
object wrapping a given map with properties.
-
Constructor Details
-
SVNProperties
public SVNProperties()Creates an emptySVNProperties
object. -
SVNProperties
Creates a newSVNProperties
object copying the given one.- Parameters:
properties
- an initializer
-
-
Method Details
-
wrap
Creates a newSVNProperties
object wrapping a given map with properties.map
is not stored by this object, instead its contents are copied into a newMap
object (which will be backed by a newSVNProperties
object) according to the following rules:-
if the value is of type
String
, then it's wrapped intoSVNPropertyValue
using theSVNPropertyValue.create(String)
method; if the value is of typebyte[]
, then it's wrapped intoSVNPropertyValue
using theSVNPropertyValue.create(String, byte[])
method; if the value is of typeSVNPropertyValue
, then it's not copied but is put into a new map as is;- Parameters:
map
- initial map holding properties- Returns:
SVNProperties
object; ifmap
is null, returns an emptySVNProperties
object created asnew SVNProperties()
- See Also:
-
unmodifiableProperties
Returns an unmodifiable view of the specifiedproperties
. Any attempt to modify the returnedSVNProperties
object result in anUnsupportedOperationException
.- Parameters:
properties
-SVNProperties
object for which an unmodifiable view is to be returned.- Returns:
- an unmodifiable view of the specified properties.
-
asMap
Returns SVNProperties as Map of String, SVNPropertyValue pairs.- Returns:
- copy of SVNProperties as Map object
-
put
Stores a new mappingpropertyName
topropertyValue
in this object.- Parameters:
propertyName
- property namepropertyValue
- property value object
-
put
Stores a new property name-to-value mapping in this object.propertyValue
is converted to anSVNPropertyValue
object through a call toSVNPropertyValue.create(String)
.- Parameters:
propertyName
- property namepropertyValue
- property value string
-
put
Stores a new property name-to-value mapping in this object.propertyValue
is converted to anSVNPropertyValue
object through a call toSVNPropertyValue.create(String)
.- Parameters:
propertyName
- property namepropertyValue
- property value string
-
put
Stores a new property name-to-value mapping in this object.propertyValue
is converted to anSVNPropertyValue
object through a call toSVNPropertyValue.create(String, byte[])
.- Parameters:
propertyName
- property namepropertyValue
- property value bytes
-
getStringValue
Returns aString
property value.- Parameters:
propertyName
- property name- Returns:
- property value string; null if
there's no such property or if it's not a
String
property value
-
getBinaryValue
Returns a binary property value.- Parameters:
propertyName
- property name- Returns:
- byte array containing property value bytes; null if there's no such property or if it's not a binary property value
-
getSVNPropertyValue
Returns a property value as anSVNPropertyValue
.- Parameters:
propertyName
- property name- Returns:
- property value object; null if there's no such property
-
remove
Removes the specified property from this properties object.- Parameters:
propertyName
- name of the property to remove from this object- Returns:
- the value of the removed object
-
putAll
Puts all properties from the specified properties object to this object.- Parameters:
properties
- properties object
-
isEmpty
public boolean isEmpty()Tells if this properties object holds no properties (empty).- Returns:
- true if this object holds no properties; otherwise false
-
clear
public void clear()Removes all properties from this object. -
removeNullValues
public void removeNullValues()Removes all mappings which values are nulls from this object. -
size
public int size()Returns the number of properties held by this object.- Returns:
- number of properties
-
containsName
Tells whether this properties object contains the specified property name.- Parameters:
propertyName
- property name- Returns:
- true if this object contains a
mapping with the specified key (
propertyName
)
-
nameSet
Returns a set of property names contained by this object.- Returns:
- property names set
-
containsValue
Tells whether this properties object contains the specified property value.- Parameters:
value
- property value- Returns:
- true if this object contains
value
-
values
Returns a collection of property values contained in this properties object.- Returns:
- property values collection
-
getRegularProperties
Returns a subset of properties contained in this properties object which suffice forSVNProperty.isRegularProperty(String)
clause.- Returns:
- regular properties; if there are no properties which would
suffice the aforementioned clause, an empty
SVNProperties
object is returned
-
compareTo
Compares this object against another one returning a difference between them. Properties which are present in this object but are not inproperties
, are put to the result as property name to null mappings. Properties which are present only inproperties
but not in this object, are added to the result. Also result will include those properties which are present in both objects but have different values; in this case result will include such properties with values fromproperties
.- Parameters:
properties
- another properties object- Returns:
- properties object holding the properties difference
-
hashCode
public int hashCode()Returns a hash code of this object. A hash code is evaluated as follows:31 +
hash code
of the underlyingMap
holding the property key to property value mappings. -
equals
Tells whether this object andobj
are equal. -
clone
Creates and returns a copy of this object.- Overrides:
clone
in classObject
- Returns:
- a clone of this instance
- Throws:
CloneNotSupportedException
-
toString
-
dispose
public void dispose()
-