diff options
author | Kevin Sawicki | 2011-05-03 00:02:15 +0000 |
---|---|---|
committer | Chris Aniszczyk | 2011-05-03 14:07:48 +0000 |
commit | e1551203823beb3e8cc7e2ef135a518dcf8bda03 (patch) | |
tree | 7001a878c230202f4d8d10654ea9e850c954e3e7 /org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github | |
parent | f6a43aac89499faa78a2c30fb2d0415dc37b800a (diff) | |
download | egit-github-e1551203823beb3e8cc7e2ef135a518dcf8bda03.tar.gz egit-github-e1551203823beb3e8cc7e2ef135a518dcf8bda03.tar.xz egit-github-e1551203823beb3e8cc7e2ef135a518dcf8bda03.zip |
Add resource provider interface for v2 api calls
Change-Id: I21983d7cf05d263a705b1c7e1538ea72e7bb3289
Signed-off-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Diffstat (limited to 'org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github')
3 files changed, 35 insertions, 7 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceProvider.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceProvider.java new file mode 100644 index 00000000..37d15b37 --- /dev/null +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceProvider.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2011 GitHub Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Kevin Sawicki (GitHub Inc.) - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +import java.util.List; + +/** + * Interface for container classes that can provide a collection of resources of + * the same type. + * + * @param <V> + */ +public interface IResourceProvider<V> { + + /** + * Get collection of resources + * + * @return non-null but possibly empty collection + */ + List<V> getResources(); + +} diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java index aa0b1e99..df3b0750 100644 --- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java @@ -17,16 +17,14 @@ import java.util.List; * * @author Kevin Sawicki (kevin@github.com) */ -public class RepositoryContainer { +public class RepositoryContainer implements IResourceProvider<Repository> { private List<Repository> repositories; /** - * Get repositories - * - * @return list of repositories + * @see org.eclipse.mylyn.github.internal.IResourceProvider#getResources() */ - public List<Repository> getRepositories() { + public List<Repository> getResources() { return this.repositories; } diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java index be8a5a30..4d24de16 100644 --- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java @@ -49,7 +49,7 @@ public class RepositoryService { RepositoryContainer container = client.get(uri.toString(), RepositoryContainer.class); - return container.getRepositories(); + return container.getResources(); } /** @@ -66,6 +66,6 @@ public class RepositoryService { RepositoryContainer container = client.get(uri.toString(), RepositoryContainer.class); - return container.getRepositories(); + return container.getResources(); } } |