001/* 002// This software is subject to the terms of the Eclipse Public License v1.0 003// Agreement, available at the following URL: 004// http://www.eclipse.org/legal/epl-v10.html. 005// You must accept the terms of that agreement to use this software. 006// 007// Copyright (C) 2004-2005 TONBELLER AG 008// Copyright (C) 2006-2011 Pentaho and others 009// All Rights Reserved. 010*/ 011package mondrian.spi; 012 013import mondrian.olap.Member; 014 015/** 016 * An SPI to redefine the caption displayed for members. 017 * 018 * <p>For example, the following class displays members of the time 019 * dimension as "01-JAN-2005". 020 * 021 * <blockquote> 022 * <code> 023 * public class TimeMemberFormatter implements MemberFormatter {<br/> 024 * public String formatMember(Member member) {<br/> 025 * SimpleDateFormat 026 * inFormat =<br/> 027 * new 028 * SimpleDateFormat("yyyy-MM-dd hh:mm:ss.S");<br/> 029 * SimpleDateFormat 030 * outFormat =<br/> 031 * new 032 * SimpleDateFormat("dd-MMM-yyyy");<br/> 033 * try {<br/> 034 * Date 035 * date = inFormat.parse(in.getName());<br/> 036 * 037 * return outFormat.format(data);<br/> 038 * } catch 039 * (ParseException e) {<br/> 040 * 041 * e.printStackTrace();<br/> 042 * 043 * return "error";<br/> 044 * }<br/> 045 * }<br/> 046 * }<br/> 047 * </code> 048 * </blockquote> 049 * 050 * @author hhaas 051 * @since 6 October, 2004 052 */ 053public interface MemberFormatter { 054 /** 055 * Returns the string to be displayed as a caption for a given member. 056 */ 057 String formatMember(Member member); 058} 059 060// End MemberFormatter.java 061