Search in sources :

Example 1 with GradleDefaultValue

use of com.android.tools.idea.gradle.dsl.model.values.GradleDefaultValue in project android by JetBrains.

the class RepositoryModel method name.

@NotNull
public GradleDefaultValue<String> name() {
    if (myDslElement == null) {
        return new GradleDefaultValue<>(null, myDefaultRepoName);
    }
    GradleDslExpression nameExpression = myDslElement.getPropertyElement(NAME, GradleDslExpression.class);
    String name = null;
    if (nameExpression != null) {
        name = nameExpression.getValue(String.class);
    }
    if (name == null) {
        name = myDefaultRepoName;
    }
    return new GradleDefaultValue<>(nameExpression, name);
}
Also used : GradleDslExpression(com.android.tools.idea.gradle.dsl.parser.elements.GradleDslExpression) GradleDefaultValue(com.android.tools.idea.gradle.dsl.model.values.GradleDefaultValue) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with GradleDefaultValue

use of com.android.tools.idea.gradle.dsl.model.values.GradleDefaultValue in project android by JetBrains.

the class UrlBasedRepositoryModel method url.

@NotNull
public GradleDefaultValue<String> url() {
    if (myDslElement == null) {
        return new GradleDefaultValue<>(null, myDefaultRepoUrl);
    }
    GradleDslExpression nameExpression = myDslElement.getPropertyElement(URL, GradleDslExpression.class);
    String url = null;
    if (nameExpression != null) {
        url = nameExpression.getValue(String.class);
    }
    if (url == null) {
        url = myDefaultRepoUrl;
    }
    return new GradleDefaultValue<>(nameExpression, url);
}
Also used : GradleDslExpression(com.android.tools.idea.gradle.dsl.parser.elements.GradleDslExpression) GradleDefaultValue(com.android.tools.idea.gradle.dsl.model.values.GradleDefaultValue) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

GradleDefaultValue (com.android.tools.idea.gradle.dsl.model.values.GradleDefaultValue)2 GradleDslExpression (com.android.tools.idea.gradle.dsl.parser.elements.GradleDslExpression)2 NotNull (org.jetbrains.annotations.NotNull)2