diff options
Diffstat (limited to 'sdkmanager/libs/sdklib/src')
4 files changed, 32 insertions, 9 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/IPropertySource.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/IPropertySource.java new file mode 100644 index 0000000..360c755 --- /dev/null +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/IPropertySource.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.sdklib.internal.project; + +/** + * A source able to return properties by name. + * + */ +public interface IPropertySource { + String getProperty(String name); +} diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java index 2bb6b71..17d3ccf 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectProperties.java @@ -55,7 +55,7 @@ import java.util.regex.Pattern; * {@link #makeWorkingCopy()}. * */ -public class ProjectProperties { +public class ProjectProperties implements IPropertySource { protected final static Pattern PATTERN_PROP = Pattern.compile( "^([a-zA-Z0-9._-]+)\\s*=\\s*(.*)\\s*$"); @@ -343,6 +343,7 @@ public class ProjectProperties { * @param name the name of the property. * @return the property value or null if the property is not set. */ + @Override public synchronized String getProperty(String name) { return mProperties.get(name); } diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java index 13c8f6a..797b505 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/project/ProjectPropertiesWorkingCopy.java @@ -90,18 +90,15 @@ public class ProjectPropertiesWorkingCopy extends ProjectProperties { * <p/> * Typical usage: * <ul> - * <li>Create a ProjectProperties with {@code PropertyType#BUILD} - * <li>Merge in values using {@code PropertyType#DEFAULT} + * <li>Create a ProjectProperties with {@code PropertyType#ANT} + * <li>Merge in values using {@code PropertyType#PROJECT} * <li>The result is that this contains all the properties from default plus those * overridden by the build.properties file. * </ul> * * @param type One the possible {@link PropertyType}s. * @return this object, for chaining. - * - * @deprecated FIXME this method is not referenced anywhere. */ - @Deprecated public synchronized ProjectPropertiesWorkingCopy merge(PropertyType type) { if (mProjectFolder.exists() && mType != type) { IAbstractFile propFile = mProjectFolder.getFile(type.getFilename()); diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java index 8373d8a..d6b2a6b 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidXPathFactory.java @@ -18,7 +18,7 @@ package com.android.sdklib.xml; import com.android.sdklib.SdkConstants; -import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -42,7 +42,7 @@ public class AndroidXPathFactory { DEFAULT_NS_PREFIX); private final String mAndroidPrefix; - private final List<String> mAndroidPrefixes = new ArrayList<String>(); + private final List<String> mAndroidPrefixes; /** * Returns the default {@link AndroidNamespaceContext}. @@ -57,7 +57,7 @@ public class AndroidXPathFactory { */ public AndroidNamespaceContext(String androidPrefix) { mAndroidPrefix = androidPrefix; - mAndroidPrefixes.add(mAndroidPrefix); + mAndroidPrefixes = Collections.singletonList(mAndroidPrefix); } @Override |