1 /* 2 // $Id: //open/mondrian/src/main/mondrian/olap/MemberFormatter.java#4 $ 3 // This software is subject to the terms of the Common Public License 4 // Agreement, available at the following URL: 5 // http://www.opensource.org/licenses/cpl.html. 6 // Copyright (C) 2004-2005 TONBELLER AG 7 // All Rights Reserved. 8 // You must accept the terms of that agreement to use this software. 9 */ 10 package mondrian.olap; 11 12 /** 13 * This interface provides an SPI to redefine the caption displayed 14 * for members. 15 * 16 * <p>For example, the following class displays members of the time 17 * dimension as "01-JAN-2005". 18 * 19 * <blockquote> 20 * <code> 21 * public class TimeMemberFormatter implements MemberFormatter {<br/> 22 * public String formatMember(Member member) {<br/> 23 * SimpleDateFormat inFormat =<br/> 24 * new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.S");<br/> 25 * SimpleDateFormat outFormat =<br/> 26 * new SimpleDateFormat("dd-MMM-yyyy");<br/> 27 * try {<br/> 28 * Date date = inFormat.parse(in.getName());<br/> 29 * return outFormat.format(data);<br/> 30 * } catch (ParseException e) {<br/> 31 * e.printStackTrace();<br/> 32 * return "error";<br/> 33 * }<br/> 34 * }<br/> 35 * }<br/> 36 * </code> 37 * </blockquote> 38 * 39 * @author hhaas 40 * @since 6 October, 2004 41 * @version $Id: //open/mondrian/src/main/mondrian/olap/MemberFormatter.java#4 $ 42 */ 43 public interface MemberFormatter { 44 /** 45 * Returns the string to be displayed as a caption for a given member. 46 */ 47 String formatMember(Member m); 48 } 49 50 // End MemberFormatter.java 51 52