Compact very simple getters in a single line

This commit is contained in:
Daniel Martí 2015-04-16 18:32:31 +02:00
parent 33fd77e3b8
commit d6a8ef9e59
11 changed files with 45 additions and 135 deletions

View File

@ -1091,24 +1091,16 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
} }
@Override @Override
public App getApp() { public App getApp() { return app; }
return app;
}
@Override @Override
public ApkListAdapter getApks() { public ApkListAdapter getApks() { return adapter; }
return adapter;
}
@Override @Override
public Signature getInstalledSignature() { public Signature getInstalledSignature() { return mInstalledSignature; }
return mInstalledSignature;
}
@Override @Override
public String getInstalledSignatureId() { public String getInstalledSignatureId() { return mInstalledSigID; }
return mInstalledSigID;
}
public static class AppDetailsSummaryFragment extends Fragment { public static class AppDetailsSummaryFragment extends Fragment {
@ -1125,21 +1117,13 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
data = (AppDetailsData)activity; data = (AppDetailsData)activity;
} }
protected App getApp() { protected App getApp() { return data.getApp(); }
return data.getApp();
}
protected ApkListAdapter getApks() { protected ApkListAdapter getApks() { return data.getApks(); }
return data.getApks();
}
protected Signature getInstalledSignature() { protected Signature getInstalledSignature() { return data.getInstalledSignature(); }
return data.getInstalledSignature();
}
protected String getInstalledSignatureId() { protected String getInstalledSignatureId() { return data.getInstalledSignatureId(); }
return data.getInstalledSignatureId();
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -1294,13 +1278,9 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
.build(); .build();
} }
private App getApp() { private App getApp() { return data.getApp(); }
return data.getApp();
}
private ApkListAdapter getApks() { private ApkListAdapter getApks() { return data.getApks(); }
return data.getApks();
}
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -1385,13 +1365,9 @@ public class AppDetails extends ActionBarActivity implements ProgressListener, A
installListener.removeApk(getApp().id); installListener.removeApk(getApp().id);
} }
protected App getApp() { protected App getApp() { return data.getApp(); }
return data.getApp();
}
protected ApkListAdapter getApks() { protected ApkListAdapter getApks() { return data.getApks(); }
return data.getApks();
}
@Override @Override
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {

View File

@ -41,9 +41,7 @@ public interface ProgressListener {
} }
@Override @Override
public int describeContents() { public int describeContents() { return 0; }
return 0;
}
@Override @Override
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
@ -72,9 +70,7 @@ public interface ProgressListener {
* so we pass that through to the downloader when we set the progress listener. This way, * so we pass that through to the downloader when we set the progress listener. This way,
* we can ask the event for the name of the repo. * we can ask the event for the name of the repo.
*/ */
public Bundle getData() { public Bundle getData() { return data; }
return data;
}
} }
} }

View File

@ -72,13 +72,9 @@ public class RepoXMLHandler extends DefaultHandler {
progressListener = listener; progressListener = listener;
} }
public List<App> getApps() { public List<App> getApps() { return apps; }
return apps;
}
public List<Apk> getApks() { public List<Apk> getApks() { return apksList; }
return apksList;
}
public int getMaxAge() { return maxage; } public int getMaxAge() { return maxage; }
@ -88,9 +84,7 @@ public class RepoXMLHandler extends DefaultHandler {
public String getName() { return name; } public String getName() { return name; }
public String getPubKey() { public String getPubKey() { return pubkey; }
return pubkey;
}
@Override @Override
public void characters(char[] ch, int start, int length) { public void characters(char[] ch, int start, int length) {

View File

@ -45,7 +45,5 @@ class HoneycombClipboard extends ClipboardCompat {
class OldClipboard extends ClipboardCompat { class OldClipboard extends ClipboardCompat {
@Override @Override
public String getText() { public String getText() { return null; }
return null;
}
} }

View File

@ -430,7 +430,5 @@ public class App extends ValueObject implements Comparable<App> {
return new AppFilter().filter(this); return new AppFilter().filter(this);
} }
public String getSuggestedVersion() { public String getSuggestedVersion() { return suggestedVersion; }
return suggestedVersion;
}
} }

View File

@ -509,23 +509,17 @@ public class AppProvider extends FDroidProvider {
} }
@Override @Override
protected String getTableName() { protected String getTableName() { return DBHelper.TABLE_APP; }
return DBHelper.TABLE_APP;
}
@Override @Override
protected String getProviderName() { protected String getProviderName() { return "AppProvider"; }
return "AppProvider";
}
public static String getAuthority() { public static String getAuthority() {
return AUTHORITY + "." + PROVIDER_NAME; return AUTHORITY + "." + PROVIDER_NAME;
} }
@Override @Override
protected UriMatcher getMatcher() { protected UriMatcher getMatcher() { return matcher; }
return matcher;
}
private AppQuerySelection queryCanUpdate() { private AppQuerySelection queryCanUpdate() {
String ignoreCurrent = " fdroid_app.ignoreThisUpdate != fdroid_app.suggestedVercode "; String ignoreCurrent = " fdroid_app.ignoreThisUpdate != fdroid_app.suggestedVercode ";

View File

@ -101,21 +101,13 @@ public class NewRepoConfig {
} }
public String getBssid() { public String getBssid() { return bssid; }
return bssid;
}
public String getSsid() { public String getSsid() { return ssid; }
return ssid;
}
public int getPort() { public int getPort() { return port; }
return port;
}
public String getRepoUriString() { public String getRepoUriString() { return uriString; }
return uriString;
}
/** /**
* This is the URI which was passed to the NewRepoConfig for parsing. * This is the URI which was passed to the NewRepoConfig for parsing.
@ -123,9 +115,7 @@ public class NewRepoConfig {
* ssid, bssid, and perhaps other query parameters. If you want the actual repo * ssid, bssid, and perhaps other query parameters. If you want the actual repo
* URL, then you will probably want {@link org.fdroid.fdroid.data.NewRepoConfig#getRepoUri()}. * URL, then you will probably want {@link org.fdroid.fdroid.data.NewRepoConfig#getRepoUri()}.
*/ */
public Uri getParsedUri() { public Uri getParsedUri() { return uri; }
return uri;
}
public Uri getRepoUri() { public Uri getRepoUri() {
if (uriString == null) { if (uriString == null) {
@ -135,29 +125,17 @@ public class NewRepoConfig {
} }
} }
public String getHost() { public String getHost() { return host; }
return host;
}
public String getScheme() { public String getScheme() { return scheme; }
return scheme;
}
public String getFingerprint() { public String getFingerprint() { return fingerprint; }
return fingerprint;
}
public boolean isValidRepo() { public boolean isValidRepo() { return isValidRepo; }
return isValidRepo;
}
public boolean isFromSwap() { public boolean isFromSwap() { return fromSwap; }
return fromSwap;
}
public boolean preventFurtherSwaps() { public boolean preventFurtherSwaps() { return preventFurtherSwaps; }
return preventFurtherSwaps;
}
/* /*
* The port starts out as 8888, but if there is a conflict, it will be * The port starts out as 8888, but if there is a conflict, it will be
@ -167,9 +145,7 @@ public class NewRepoConfig {
return (port >= 8888 && host.matches("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+")); return (port >= 8888 && host.matches("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"));
} }
public String getErrorMessage() { public String getErrorMessage() { return errorMessage; }
return errorMessage;
}
/** Sanitize and format an incoming repo URI for function and readability */ /** Sanitize and format an incoming repo URI for function and readability */
public static String sanitizeRepoUri(Uri uri) { public static String sanitizeRepoUri(Uri uri) {

View File

@ -31,13 +31,9 @@ public class QuerySelection {
this.selection = selection; this.selection = selection;
} }
public String[] getArgs() { public String[] getArgs() { return args; }
return args;
}
public String getSelection() { public String getSelection() { return selection; }
return selection;
}
public boolean hasSelection() { public boolean hasSelection() {
return selection != null && selection.length() > 0; return selection != null && selection.length() > 0;

View File

@ -85,14 +85,10 @@ public class Repo extends ValueObject {
public long getId() { return id; } public long getId() { return id; }
public String getName() { public String getName() { return name; }
return name;
}
@Override @Override
public String toString() { public String toString() { return address; }
return address;
}
public boolean isSigned() { public boolean isSigned() {
return !TextUtils.isEmpty(this.pubkey); return !TextUtils.isEmpty(this.pubkey);

View File

@ -272,15 +272,9 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
} }
} }
public Apk getApk() { public Apk getApk() { return curApk; }
return curApk;
}
public int getProgress() { public int getProgress() { return progress; }
return progress;
}
public int getTotalSize() { public int getTotalSize() { return totalSize; }
return totalSize;
}
} }

View File

@ -64,17 +64,11 @@ abstract public class RepoUpdater {
this.progressListener = progressListener; this.progressListener = progressListener;
} }
public boolean hasChanged() { public boolean hasChanged() { return hasChanged; }
return hasChanged;
}
public List<App> getApps() { public List<App> getApps() { return apps; }
return apps;
}
public List<Apk> getApks() { public List<Apk> getApks() { return apks; }
return apks;
}
/** /**
* For example, you may want to unzip a jar file to get the index inside, * For example, you may want to unzip a jar file to get the index inside,
@ -238,9 +232,7 @@ abstract public class RepoUpdater {
return values; return values;
} }
public RepoUpdateRememberer getRememberer() { public RepoUpdateRememberer getRememberer() { return rememberer; }
return rememberer;
}
public static class RepoUpdateRememberer { public static class RepoUpdateRememberer {