From: <jbo...@li...> - 2005-09-06 06:53:56
|
Author: adamw Date: 2005-09-06 02:53:53 -0400 (Tue, 06 Sep 2005) New Revision: 1047 Modified: trunk/jira-extensions/cache/src/java/pl/net/mamut/jira/Cache.java Log: Some comments Modified: trunk/jira-extensions/cache/src/java/pl/net/mamut/jira/Cache.java =================================================================== --- trunk/jira-extensions/cache/src/java/pl/net/mamut/jira/Cache.java 2005-09-05 21:45:40 UTC (rev 1046) +++ trunk/jira-extensions/cache/src/java/pl/net/mamut/jira/Cache.java 2005-09-06 06:53:53 UTC (rev 1047) @@ -6,6 +6,11 @@ import java.util.HashMap; import java.util.Map; +/** + * @author adamw + * An object holder which holds the object only for some time (by default, + * one day). + */ class ObjectWithTime { private Object o; private long time; @@ -17,6 +22,10 @@ time = Calendar.getInstance().getTimeInMillis(); } + /** + * @return Object that is remembered by this instance or null + * if the object is held for longer then one day. + */ public Object get() { long now = Calendar.getInstance().getTimeInMillis(); if (now - time > TIMEOUT) @@ -86,6 +95,9 @@ try { String[] p; p = (String []) params.get(name); + + if (p == null) return "null"; + String ret = ""; for (int i=0; i<p.length; i++) ret += p[i] + ", "; @@ -99,6 +111,12 @@ } } + /** + * Gets a string representation of all objects in the given + * array. + * @param a Array to convert. + * @return A string of the form: a[0] + ", " + a[1] + .... + */ public static String objectArrayToString(Object[] a) { String ret = ""; for (int i=0; i<a.length; i++) |