Class SVNProperties

java.lang.Object
org.tmatesoft.svn.core.SVNProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class SVNProperties extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable
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
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private java.util.Map<java.lang.String,SVNPropertyValue>
     
    private static final long
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    Creates an empty SVNProperties object.
    private
    SVNProperties(java.util.Map properties)
     
     
    Creates a new SVNProperties object copying the given one.
  • Method Summary

    Modifier and Type
    Method
    Description
    java.util.Map<java.lang.String,SVNPropertyValue>
    Returns SVNProperties as Map of String, SVNPropertyValue pairs.
    void
    Removes all properties from this object.
    java.lang.Object
    Creates and returns a copy of this object.
    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
    Tells whether this properties object contains the specified property value.
    void
     
    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.
    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.
    getSVNPropertyValue(java.lang.String propertyName)
    Returns a property value as an SVNPropertyValue.
    int
    Returns a hash code of this object.
    boolean
    Tells if this properties object holds no properties (empty).
    java.util.Set<java.lang.String>
    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, char[] propertyValue, java.lang.String encoding)
    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.
    remove(java.lang.String propertyName)
    Removes the specified property from this properties object.
    void
    Removes all mappings which values are nulls from this object.
    int
    Returns the number of properties held by this object.
    java.lang.String
     
    Returns an unmodifiable view of the specified properties.
    java.util.Collection
    Returns a collection of property values contained in this properties object.
    wrap(java.util.Map map)
    Creates a new SVNProperties object wrapping a given map with properties.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • SVNProperties

      public SVNProperties()
      Creates an empty SVNProperties object.
    • SVNProperties

      public SVNProperties(SVNProperties properties)
      Creates a new SVNProperties object copying the given one.
      Parameters:
      properties - an initializer
    • SVNProperties

      private SVNProperties(java.util.Map properties)
  • Method Details

    • wrap

      public static SVNProperties wrap(java.util.Map map)
      Creates a new 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:

      Parameters:
      map - initial map holding properties
      Returns:
      SVNProperties object; if map is null, returns an empty SVNProperties object created as new SVNProperties()
      See Also:
    • unmodifiableProperties

      public static SVNProperties unmodifiableProperties(SVNProperties properties)
      Returns an unmodifiable view of the specified properties. Any attempt to modify the returned SVNProperties object result in an UnsupportedOperationException.
      Parameters:
      properties - SVNProperties object for which an unmodifiable view is to be returned.
      Returns:
      an unmodifiable view of the specified properties.
    • asMap

      public java.util.Map<java.lang.String,SVNPropertyValue> asMap()
      Returns SVNProperties as Map of String, SVNPropertyValue pairs.
      Returns:
      copy of SVNProperties as Map object
    • put

      public void put(java.lang.String propertyName, SVNPropertyValue propertyValue)
      Stores a new mapping propertyName to propertyValue in this object.
      Parameters:
      propertyName - property name
      propertyValue - property value object
    • put

      public void put(java.lang.String propertyName, java.lang.String propertyValue)
      Stores a new property name-to-value mapping in this object.

      propertyValue is converted to an SVNPropertyValue object through a call to SVNPropertyValue.create(String).

      Parameters:
      propertyName - property name
      propertyValue - property value string
    • put

      public void put(java.lang.String propertyName, char[] propertyValue, java.lang.String encoding)
      Stores a new property name-to-value mapping in this object.

      propertyValue is converted to an SVNPropertyValue object through a call to SVNPropertyValue.create(String).

      Parameters:
      propertyName - property name
      propertyValue - property value string
    • put

      public void put(java.lang.String propertyName, byte[] propertyValue)
      Stores a new property name-to-value mapping in this object.

      propertyValue is converted to an SVNPropertyValue object through a call to SVNPropertyValue.create(String, byte[]).

      Parameters:
      propertyName - property name
      propertyValue - property value bytes
    • getStringValue

      public java.lang.String getStringValue(java.lang.String propertyName)
      Returns a String 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

      public byte[] getBinaryValue(java.lang.String propertyName)
      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

      public SVNPropertyValue getSVNPropertyValue(java.lang.String propertyName)
      Returns a property value as an SVNPropertyValue.
      Parameters:
      propertyName - property name
      Returns:
      property value object; null if there's no such property
    • remove

      public SVNPropertyValue remove(java.lang.String propertyName)
      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

      public void putAll(SVNProperties properties)
      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

      public boolean containsName(java.lang.String propertyName)
      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

      public java.util.Set<java.lang.String> nameSet()
      Returns a set of property names contained by this object.
      Returns:
      property names set
    • containsValue

      public boolean containsValue(SVNPropertyValue value)
      Tells whether this properties object contains the specified property value.
      Parameters:
      value - property value
      Returns:
      true if this object contains value
    • values

      public java.util.Collection values()
      Returns a collection of property values contained in this properties object.
      Returns:
      property values collection
    • getRegularProperties

      public SVNProperties getRegularProperties()
      Returns a subset of properties contained in this properties object which suffice for SVNProperty.isRegularProperty(String) clause.
      Returns:
      regular properties; if there are no properties which would suffice the aforementioned clause, an empty SVNProperties object is returned
    • compareTo

      public SVNProperties compareTo(SVNProperties properties)
      Compares this object against another one returning a difference between them.

      Properties which are present in this object but are not in 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.

      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 underlying Map holding the property key to property value mappings.

      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hash code of this object
    • equals

      public boolean equals(java.lang.Object obj)
      Tells whether this object and obj are equal.
      Overrides:
      equals in class java.lang.Object
      Parameters:
      obj - object to compare with
      Returns:
      true if obj is either this very object, or is an instance of SVNProperties with the same contents of properties
    • clone

      public java.lang.Object clone() throws java.lang.CloneNotSupportedException
      Creates and returns a copy of this object.
      Overrides:
      clone in class java.lang.Object
      Returns:
      a clone of this instance
      Throws:
      java.lang.CloneNotSupportedException
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • dispose

      public void dispose()