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 emptySVNPropertiesobject.SVNProperties(SVNProperties properties) Creates a newSVNPropertiesobject copying the given one. -
Method Summary
Modifier and TypeMethodDescriptionasMap()Returns SVNProperties as Map of String, SVNPropertyValue pairs.voidclear()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.booleancontainsName(String propertyName) Tells whether this properties object contains the specified property name.booleancontainsValue(SVNPropertyValue value) Tells whether this properties object contains the specified property value.voiddispose()booleanTells whether this object andobjare 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 aStringproperty value.getSVNPropertyValue(String propertyName) Returns a property value as anSVNPropertyValue.inthashCode()Returns a hash code of this object.booleanisEmpty()Tells if this properties object holds no properties (empty).nameSet()Returns a set of property names contained by this object.voidStores a new property name-to-value mapping in this object.voidStores a new property name-to-value mapping in this object.voidStores a new property name-to-value mapping in this object.voidput(String propertyName, SVNPropertyValue propertyValue) Stores a new mappingpropertyNametopropertyValuein this object.voidputAll(SVNProperties properties) Puts all properties from the specified properties object to this object.Removes the specified property from this properties object.voidRemoves all mappings which values are nulls from this object.intsize()Returns the number of properties held by this object.toString()static SVNPropertiesunmodifiableProperties(SVNProperties properties) Returns an unmodifiable view of the specifiedproperties.values()Returns a collection of property values contained in this properties object.static SVNPropertiesCreates a newSVNPropertiesobject wrapping a given map with properties.
-
Constructor Details
-
SVNProperties
public SVNProperties()Creates an emptySVNPropertiesobject. -
SVNProperties
Creates a newSVNPropertiesobject copying the given one.- Parameters:
properties- an initializer
-
-
Method Details
-
wrap
Creates a newSVNPropertiesobject wrapping a given map with properties.mapis not stored by this object, instead its contents are copied into a newMapobject (which will be backed by a newSVNPropertiesobject) according to the following rules:-
if the value is of type
String, then it's wrapped intoSVNPropertyValueusing theSVNPropertyValue.create(String)method; if the value is of typebyte[], then it's wrapped intoSVNPropertyValueusing 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:
SVNPropertiesobject; ifmapis null, returns an emptySVNPropertiesobject created asnew SVNProperties()- See Also:
-
unmodifiableProperties
Returns an unmodifiable view of the specifiedproperties. Any attempt to modify the returnedSVNPropertiesobject result in anUnsupportedOperationException.- Parameters:
properties-SVNPropertiesobject 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 mappingpropertyNametopropertyValuein this object.- Parameters:
propertyName- property namepropertyValue- property value object
-
put
Stores a new property name-to-value mapping in this object.propertyValueis converted to anSVNPropertyValueobject 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.propertyValueis converted to anSVNPropertyValueobject 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.propertyValueis converted to anSVNPropertyValueobject through a call toSVNPropertyValue.create(String, byte[]).- Parameters:
propertyName- property namepropertyValue- property value bytes
-
getStringValue
Returns aStringproperty value.- Parameters:
propertyName- property name- Returns:
- property value string; null if
there's no such property or if it's not a
Stringproperty 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
SVNPropertiesobject 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 inpropertiesbut 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 codeof the underlyingMapholding the property key to property value mappings. -
equals
Tells whether this object andobjare equal. -
clone
Creates and returns a copy of this object.- Overrides:
clonein classObject- Returns:
- a clone of this instance
- Throws:
CloneNotSupportedException
-
toString
-
dispose
public void dispose()
-