From cb9b3175c21a5a690d12e7454a3f957989cebdd7 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Fri, 10 Oct 2003 03:10:31 +0000 Subject: [PATCH] Made all getters private in order to avoid problem with Tomcat/Orion. --- .../thauvin/google/taglibs/KeySupport.java | 30 +-- .../net/thauvin/google/taglibs/Search.java | 194 ++++++++---------- 2 files changed, 104 insertions(+), 120 deletions(-) diff --git a/google-taglib/src/net/thauvin/google/taglibs/KeySupport.java b/google-taglib/src/net/thauvin/google/taglibs/KeySupport.java index 9fee9fe..af62a6a 100644 --- a/google-taglib/src/net/thauvin/google/taglibs/KeySupport.java +++ b/google-taglib/src/net/thauvin/google/taglibs/KeySupport.java @@ -79,13 +79,27 @@ public abstract class KeySupport extends BodyTagSupport this.key = key; } + /** + * Release method. + */ + public void release() + { + super.release(); + + // Reset the key value + key = null; + + // Reset the values + reset(); + } + /** * Returns the key attribute. * * @return The attribute value. * @see #setKey(String) */ - public String getKey() + protected String getKey() { if (TagUtility.isValidString(key, true)) { @@ -130,20 +144,6 @@ public abstract class KeySupport extends BodyTagSupport return ""; } - /** - * Release method. - */ - public void release() - { - super.release(); - - // Reset the key value - key = null; - - // Reset the values - reset(); - } - /** * Reset the values. */ diff --git a/google-taglib/src/net/thauvin/google/taglibs/Search.java b/google-taglib/src/net/thauvin/google/taglibs/Search.java index 77c8210..be161e5 100644 --- a/google-taglib/src/net/thauvin/google/taglibs/Search.java +++ b/google-taglib/src/net/thauvin/google/taglibs/Search.java @@ -57,7 +57,7 @@ public class Search extends QuerySupport private String lr = GoogleSearchBean.DEFAULT_LR; private String restrict = GoogleSearchBean.DEFAULT_RESTRICT; private String site = GoogleSearchBean.DEFAULT_SITE; - private boolean cache = true; + private boolean cache = GoogleSearchBean.DEFAULT_CACHE; private boolean filter = GoogleSearchBean.DEFAULT_FILTER; private boolean safeSearch = GoogleSearchBean.DEFAULT_SAFE_SEARCH; private int maxResults = GoogleSearchBean.DEFAULT_MAX_RESULTS; @@ -67,73 +67,36 @@ public class Search extends QuerySupport * Sets the cache attribute. * * @param cache The new attribute value. - * @see #getCache() */ public final void setCache(String cache) { this.cache = Boolean.valueOf(cache).booleanValue(); } - /** - * Returns the cache attribute. - * - * @return The attribute value. - * @see #setCache(String) - */ - public final boolean getCache() - { - return getBoolParam(TagUtility.CACHE_PARAM, cache); - } - /** * Sets the (related-query) filter attribute. * * @param filter The new attribute value. - * @see #getFilter() */ public final void setFilter(String filter) { this.filter = Boolean.valueOf(filter).booleanValue(); } - /** - * Returns the (related-query) filter attribute. - * - * @return The attribute value. - * @see #setFilter(String) - */ - public final boolean getFilter() - { - return getBoolParam(TagUtility.FILTER_PARAM, filter); - } - /** * Sets the lr (language restrict) attribute. * * @param lr The new attribute value. - * @see #getLr() */ public final void setLr(String lr) { this.lr = lr; } - /** - * Returns the lr (language restrict) attribute. - * - * @return The attribute value. - * @see #setLr(String) - */ - public final String getLr() - { - return getStringParam(TagUtility.LR_PARAM, lr); - } - /** * Sets the maximum number of results to be returned. * * @param maxResults The new attribute value. - * @see #getMaxResults() */ public final void setMaxResults(String maxResults) { @@ -147,95 +110,40 @@ public class Search extends QuerySupport } } - /** - * Returns the maximum number of results to be returned. - * - * @return The attribute value. - * @see #setMaxResults(String) - */ - public final int getMaxResults() - { - return getIntParam(TagUtility.MAX_RESULTS_PARAM, maxResults); - } - /** * Sets the restrict attribute. * * @param restrict The new restrict attribute. - * @see #getRestrict() */ public final void setRestrict(String restrict) { this.restrict = restrict; } - /** - * Returns the restrict attribute. - * - * @return The attribute value. - * @see #setRestrict(String) - */ - public final String getRestrict() - { - return getStringParam(TagUtility.RESTRICT_PARAM, restrict); - } - /** * Sets the safeSearch attribute. * * @param safeSearch The new attribute value. - * @see #getSafeSearch() */ public final void setSafeSearch(String safeSearch) { this.safeSearch = Boolean.valueOf(safeSearch).booleanValue(); } - /** - * Returns the safeSearch attribute. - * - * @return The attribute value. - * @see #setSafeSearch(String) - */ - public final boolean getSafeSearch() - { - return getBoolParam(TagUtility.SAFE_SEARCH_PARAM, safeSearch); - } - /** * Sets the site attribute. * * @param site The new attribute value. - * @see #getSite() */ public final void setSite(String site) { this.site = site; } - /** - * Returns the stie attribute. - * - * @return The attribute value. - * @see #setSite(String) - */ - public final String getSite() - { - String site = getStringParam(TagUtility.SITE_PARAM, this.site); - - if (site.length() > 0) - { - return ("site:" + site + ' '); - } - - return ""; - } - /** * Sets the start attribute. * * @param start The new attribute value. - * @see #getStart() */ public final void setStart(String start) { @@ -249,17 +157,6 @@ public class Search extends QuerySupport } } - /** - * Returns the start attribute. - * - * @return The attribute value. - * @see #setStart(String) - */ - public final int getStart() - { - return getIntParam(TagUtility.START_PARAM, start); - } - /** * doEndTag method. * @@ -351,7 +248,7 @@ public class Search extends QuerySupport restrict = GoogleSearchBean.DEFAULT_RESTRICT; lr = GoogleSearchBean.DEFAULT_LR; site = GoogleSearchBean.DEFAULT_SITE; - cache = true; + cache = GoogleSearchBean.DEFAULT_CACHE; // Reset the bean bean = null; @@ -368,6 +265,93 @@ public class Search extends QuerySupport super.reset(); } + /** + * Returns the cache attribute. + * + * @return The attribute value. + */ + private final boolean getCache() + { + return getBoolParam(TagUtility.CACHE_PARAM, cache); + } + + /** + * Returns the (related-query) filter attribute. + * + * @return The attribute value. + */ + private final boolean getFilter() + { + return getBoolParam(TagUtility.FILTER_PARAM, filter); + } + + /** + * Returns the lr (language restrict) attribute. + * + * @return The attribute value. + */ + private final String getLr() + { + return getStringParam(TagUtility.LR_PARAM, lr); + } + + /** + * Returns the maximum number of results to be returned. + * + * @return The attribute value. + */ + private final int getMaxResults() + { + return getIntParam(TagUtility.MAX_RESULTS_PARAM, maxResults); + } + + /** + * Returns the restrict attribute. + * + * @return The attribute value. + */ + private final String getRestrict() + { + return getStringParam(TagUtility.RESTRICT_PARAM, restrict); + } + + /** + * Returns the safeSearch attribute. + * + * @return The attribute value. + */ + private final boolean getSafeSearch() + { + return getBoolParam(TagUtility.SAFE_SEARCH_PARAM, safeSearch); + } + + /** + * Returns the site attribute. + * + * @return The attribute value. + */ + private final String getSite() + { + String site = getStringParam(TagUtility.SITE_PARAM, this.site); + + if (site.length() > 0) + { + return ("site:" + site + ' '); + } + + return ""; + } + + /** + * Returns the start attribute. + * + * @return The attribute value. + */ + private final int getStart() + { + return getIntParam(TagUtility.START_PARAM, start); + } + /** * Converts a request parameter to a boolean. *