Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2D007174CE for ; Mon, 13 Apr 2015 14:32:13 +0000 (UTC) Received: (qmail 87117 invoked by uid 500); 13 Apr 2015 14:32:12 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 87023 invoked by uid 500); 13 Apr 2015 14:32:12 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 86831 invoked by uid 99); 13 Apr 2015 14:32:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Apr 2015 14:32:12 +0000 Date: Mon, 13 Apr 2015 14:32:12 +0000 (UTC) From: "Richard Eigenmann (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Issue Comment Deleted] (JCS-124) Make the code in Step 5 on the JCS overview page a full working class that can compile MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/JCS-124?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:all-tabpanel ] Richard Eigenmann updated JCS-124: ---------------------------------- Comment: was deleted (was: Here comes the unified diff: import java.io.Serializable; import org.apache.commons.jcs.JCS; import org.apache.commons.jcs.access.CacheAccess; import org.apache.commons.jcs.access.exception.CacheException; public class JcsExample { public static void main( String[] args ) { JcsExample example =3D new JcsExample(); example.testCache(); } private CacheAccess cache =3D null; public JcsExample() { try { cache =3D JCS.getInstance( "default" ); } catch ( CacheException e ) { System.out.println( String.format( "Problem initializing cache:= %s", e.getMessage() ) ); } } public void putInCache( City city ) { String key =3D city.name; try { cache.put( key, city ); } catch ( CacheException e ) { System.out.println( String.format( "Problem putting city %s in = the cache, for key %s%n%s", city.name, key, e.getMessage() ) ); } } public City retrieveFromCache( String cityKey ) { return cache.get( cityKey ); } public void testCache() { City zurich =3D new City( "Z=C3=BCrich", "Switzerland", 366765 ); putInCache( zurich ); =20 City berlin =3D new City( "Berlin", "Germany", 3502000 ); putInCache( berlin ); =20 City johannesburg =3D new City( "Johannesburg", "South Africa", 122= 00000 ); putInCache( johannesburg ); City retrievedCity1 =3D retrieveFromCache( "Berlin" ); if ( retrievedCity1 !=3D null ) { System.out.println( retrievedCity1.toString() ); } else { System.out.println( "No object was found in the cache for the k= ey \"Berlin\"" ); } City retrievedCity2 =3D retrieveFromCache( "New York" ); if ( retrievedCity2 !=3D null ) { System.out.println( retrievedCity2.toString() ); } else { System.out.println( "No object was found in the cache for the k= ey \"New York\"" ); } } // defined as a nested inner class to reduce number of .java files in t= he example public class City implements Serializable { private static final long serialVersionUID =3D 6392376146163510146L= ; public String name; public String country; public int population; public City( String name, String country, int population ) { this.name =3D name; this.country =3D country; this.population =3D population; } @Override public String toString() { return String.format( "%s is a city in the country %s with a po= pulation of %d", name, country, population ); } } } ) > Make the code in Step 5 on the JCS overview page a full working class tha= t can compile > -------------------------------------------------------------------------= ------------- > > Key: JCS-124 > URL: https://issues.apache.org/jira/browse/JCS-124 > Project: Commons JCS > Issue Type: Improvement > Components: Documentation > Affects Versions: jcs-2.0-beta-1 > Environment: Testing > Reporter: Richard Eigenmann > Fix For: jcs-2.0-beta-2 > > Attachments: intro.xml > > > Step 5: http://commons.apache.org/proper/commons-jcs/getting_started/intr= o.html > Please make this a fully compilable class that can be cut and pasted for = a quick success experience for the newby. > Defaults and examples are extremely powerful and many people never ventur= e further than the defaults and samples they discovered so it is extremely = important to show sensible default values and good code. > In this vein, drop the words "might" and "could" in the comments. It's ei= ther a good way to do it or you should not be showing it for it will be cop= ied. > Please also correct the setCache(c); instruction which doesn't make sense= . The example doesn't indicate that it is extending another class where set= Cache(c) might be defined and isn't defining the method. Is this instructio= n needed? -- This message was sent by Atlassian JIRA (v6.3.4#6332)