1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Eclipse Public License, Version 1.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.eclipse.org/org/documents/epl-v10.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.ide.eclipse.adt.internal.wizards.exportgradle; 18 19 import com.android.annotations.NonNull; 20 import com.google.common.collect.Lists; 21 22 import org.eclipse.core.resources.IProject; 23 import org.eclipse.jdt.core.IJavaProject; 24 25 import java.util.List; 26 27 /** 28 * A configured Gradle module for export. This includes gradle path, dependency, type, etc... 29 */ 30 public class GradleModule { 31 32 @NonNull 33 private final IJavaProject mJavaProject; 34 35 private String mPath; 36 private Type mType; 37 38 private final List<GradleModule> mDependencies = Lists.newArrayList(); 39 40 public static enum Type { ANDROID, JAVA }; 41 GradleModule(@onNull IJavaProject javaProject)42 GradleModule(@NonNull IJavaProject javaProject) { 43 mJavaProject = javaProject; 44 } 45 46 @NonNull getJavaProject()47 public IJavaProject getJavaProject() { 48 return mJavaProject; 49 } 50 51 @NonNull getProject()52 public IProject getProject() { 53 return mJavaProject.getProject(); 54 } 55 isConfigured()56 boolean isConfigured() { 57 return mType != null; 58 } 59 setType(Type type)60 public void setType(Type type) { 61 mType = type; 62 } 63 getType()64 public Type getType() { 65 return mType; 66 } 67 addDependency(GradleModule module)68 public void addDependency(GradleModule module) { 69 mDependencies.add(module); 70 } 71 getDependencies()72 public List<GradleModule> getDependencies() { 73 return mDependencies; 74 } 75 setPath(String path)76 public void setPath(String path) { 77 mPath = path; 78 } 79 getPath()80 public String getPath() { 81 return mPath; 82 } 83 84 @Override toString()85 public String toString() { 86 return "GradleModule [mJavaProject=" + mJavaProject + ", mPath=" + mPath + ", mType=" 87 + mType + ", mDependencies=" + mDependencies + "]"; 88 } 89 } 90 91