public class SVNProperties
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
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.
Constructor and Description |
---|
SVNProperties()
Creates an empty
SVNProperties object. |
SVNProperties(SVNProperties properties)
Creates a new
SVNProperties object copying the given one. |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,SVNPropertyValue> |
asMap()
Returns SVNProperties as Map of String, SVNPropertyValue pairs.
|
void |
clear()
Removes all properties from this object.
|
java.lang.Object |
clone()
Creates and returns a copy of this object.
|
SVNProperties |
compareTo(SVNProperties properties)
Compares this object against another one returning a difference between
them.
|
boolean |
containsName(java.lang.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.
|
boolean |
equals(java.lang.Object obj)
Tells whether this object and
obj are equal. |
byte[] |
getBinaryValue(java.lang.String propertyName)
Returns a binary property value.
|
SVNProperties |
getRegularProperties()
Returns a subset of properties contained in this properties object which
suffice for
SVNProperty.isRegularProperty(String) clause. |
java.lang.String |
getStringValue(java.lang.String propertyName)
Returns a
String property value. |
SVNPropertyValue |
getSVNPropertyValue(java.lang.String propertyName)
Returns a property value as an
SVNPropertyValue . |
int |
hashCode()
Returns a hash code of this object.
|
boolean |
isEmpty()
Tells if this properties object holds no properties (empty).
|
java.util.Set<java.lang.String> |
nameSet()
Returns a set of property names contained by this object.
|
void |
put(java.lang.String propertyName,
byte[] propertyValue)
Stores a new property name-to-value mapping in this object.
|
void |
put(java.lang.String propertyName,
java.lang.String propertyValue)
Stores a new property name-to-value mapping in this object.
|
void |
put(java.lang.String propertyName,
SVNPropertyValue propertyValue)
Stores a new mapping
propertyName to
propertyValue in this object. |
void |
putAll(SVNProperties properties)
Puts all properties from the specified properties object to this object.
|
SVNPropertyValue |
remove(java.lang.String propertyName)
Removes the specified property from this properties object.
|
void |
removeNullValues()
Removes all mappings which values are nulls from this object.
|
int |
size()
Returns the number of properties held by this object.
|
java.lang.String |
toString() |
static SVNProperties |
unmodifiableProperties(SVNProperties properties)
Returns an unmodifiable view of the specified
properties . |
java.util.Collection |
values()
Returns a collection of property values contained in this properties
object.
|
static SVNProperties |
wrap(java.util.Map map)
Creates a new
SVNProperties object wrapping a given map with
properties. |
public SVNProperties()
SVNProperties
object.public SVNProperties(SVNProperties properties)
SVNProperties
object copying the given one.properties
- an initializerpublic static SVNProperties wrap(java.util.Map map)
SVNProperties
object wrapping a given map with
properties.
map
is not stored by this object, instead its contents are
copied into a new Map
object (which will be backed by a new
SVNProperties
object) according to the following rules:
String
, then it's wrapped into
SVNPropertyValue
using the
SVNPropertyValue.create(String)
method;
if the value is of type byte[]
, then it's wrapped into
SVNPropertyValue
using the
SVNPropertyValue.create(String, byte[])
method;
if the value is of type SVNPropertyValue
, then it's not
copied but is put into a new map as is;
map
- initial map holding propertiesSVNProperties
object; if map
is null, returns an empty
SVNProperties
object created as
new SVNProperties()
SVNProperties()
public static SVNProperties unmodifiableProperties(SVNProperties properties)
properties
.
Any attempt to modify the returned SVNProperties
object
result in an UnsupportedOperationException
.properties
- SVNProperties
object for which an unmodifiable
view is to be returned.public java.util.Map<java.lang.String,SVNPropertyValue> asMap()
public void put(java.lang.String propertyName, SVNPropertyValue propertyValue)
propertyName
to
propertyValue
in this object.propertyName
- property namepropertyValue
- property value objectpublic void put(java.lang.String propertyName, java.lang.String propertyValue)
propertyValue
is converted to an SVNPropertyValue
object through a call to SVNPropertyValue.create(String)
.
propertyName
- property namepropertyValue
- property value stringpublic void put(java.lang.String propertyName, byte[] propertyValue)
propertyValue
is converted to an SVNPropertyValue
object through a call to SVNPropertyValue.create(String, byte[])
.
propertyName
- property namepropertyValue
- property value bytespublic java.lang.String getStringValue(java.lang.String propertyName)
String
property value.propertyName
- property nameString
property valuepublic byte[] getBinaryValue(java.lang.String propertyName)
propertyName
- property namepublic SVNPropertyValue getSVNPropertyValue(java.lang.String propertyName)
SVNPropertyValue
.propertyName
- property namepublic SVNPropertyValue remove(java.lang.String propertyName)
propertyName
- name of the property to remove from this objectpublic void putAll(SVNProperties properties)
properties
- properties objectpublic boolean isEmpty()
public void clear()
public void removeNullValues()
public int size()
public boolean containsName(java.lang.String propertyName)
propertyName
- property namepropertyName
)public java.util.Set<java.lang.String> nameSet()
public boolean containsValue(SVNPropertyValue value)
value
- property valuevalue
public java.util.Collection values()
public SVNProperties getRegularProperties()
SVNProperty.isRegularProperty(String)
clause.SVNProperties
object is returnedpublic SVNProperties compareTo(SVNProperties properties)
properties
, are put to the result as property name to null mappings. Properties which are present
only in properties
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 from properties
.properties
- another properties objectpublic int hashCode()
31 +
hash code
of the underlying
Map
holding the property key to property value mappings.hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
obj
are equal.equals
in class java.lang.Object
obj
- object to compare withobj
is
either this very object, or is an instance of
SVNProperties
with the same contents of propertiespublic java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2004-2012 TMate Software Ltd. All Rights Reserved.