com.android.sdklib.internal.project
Class ProjectPropertiesWorkingCopy

java.lang.Object
  extended by com.android.sdklib.internal.project.ProjectProperties
      extended by com.android.sdklib.internal.project.ProjectPropertiesWorkingCopy
All Implemented Interfaces:
IPropertySource

public class ProjectPropertiesWorkingCopy
extends ProjectProperties

A modifiable and savable copy of a ProjectProperties.

This copy gives access to modification method such as setProperty(String, String) and removeProperty(String). To get access to an instance, use ProjectProperties.makeWorkingCopy() or ProjectProperties.create(IAbstractFolder, PropertyType).


Nested Class Summary
 
Nested classes/interfaces inherited from class com.android.sdklib.internal.project.ProjectProperties
ProjectProperties.PropertyType
 
Field Summary
 
Fields inherited from class com.android.sdklib.internal.project.ProjectProperties
mProjectFolder, mProperties, mType, PATTERN_PROP, PROPERTY_BUILD_OUT_DIR, PROPERTY_BUILD_SOURCE_DIR, PROPERTY_BUILD_TOOLS, PROPERTY_KEY_ALIAS, PROPERTY_KEY_STORE, PROPERTY_LIB_REF, PROPERTY_LIBRARY, PROPERTY_PACKAGE, PROPERTY_PROGUARD_CONFIG, PROPERTY_PROJECTS, PROPERTY_RS_TARGET, PROPERTY_RULES_PATH, PROPERTY_SDK, PROPERTY_SPLIT_BY_ABI, PROPERTY_SPLIT_BY_DENSITY, PROPERTY_SPLIT_BY_LOCALE, PROPERTY_TARGET, PROPERTY_TESTED_PROJECT, PROPERTY_VERSIONCODE
 
Method Summary
 ProjectProperties makeReadOnlyCopy()
           
 ProjectPropertiesWorkingCopy merge(ProjectProperties.PropertyType type)
          Merges all properties from the given file into the current properties.
 java.lang.String removeProperty(java.lang.String name)
          Removes a property and returns its previous value (or null if the property did not exist).
 void save()
          Saves the property file, using UTF-8 encoding.
 void setProperty(java.lang.String name, java.lang.String value)
          Sets a new properties.
 
Methods inherited from class com.android.sdklib.internal.project.ProjectProperties
create, create, createEmpty, createEmpty, debugPrint, delete, delete, escape, getFile, getProperty, getType, keySet, load, load, makeWorkingCopy, makeWorkingCopy, parsePropertyFile, reload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Sets a new properties. If a property with the same name already exists, it is replaced.

Parameters:
name - the name of the property.
value - the value of the property.

removeProperty

public java.lang.String removeProperty(java.lang.String name)
Removes a property and returns its previous value (or null if the property did not exist).

Parameters:
name - the name of the property to remove.

merge

public ProjectPropertiesWorkingCopy merge(ProjectProperties.PropertyType type)
Merges all properties from the given file into the current properties.

This emulates the Ant behavior: existing properties are not overridden. Only new undefined properties become defined.

Typical usage:

Parameters:
type - One the possible ProjectProperties.PropertyTypes.
Returns:
this object, for chaining.

save

public void save()
          throws java.io.IOException,
                 com.android.io.StreamException
Saves the property file, using UTF-8 encoding.

Throws:
java.io.IOException
com.android.io.StreamException

makeReadOnlyCopy

@NonNull
public ProjectProperties makeReadOnlyCopy()