1 25 26 package org.snipsnap.render.macro; 27 28 import org.radeox.macro.Macro; 29 import org.radeox.macro.BaseMacro; 30 import org.radeox.macro.parameter.MacroParameter; 31 import org.radeox.util.i18n.ResourceManager; 32 import org.snipsnap.snip.SnipSpaceFactory; 33 34 import java.io.IOException ; 35 import java.io.Writer ; 36 37 43 44 public class SnipCountMacro extends BaseMacro { 45 public String getName() { 46 return "snip-count"; 47 } 48 49 public String getDescription() { 50 return ResourceManager.getString("i18n.messages", "macro.snipcount.description"); 51 } 52 53 public void execute(Writer writer, MacroParameter params) 54 throws IllegalArgumentException , IOException { 55 if (params.getLength() == 0) { 56 writer.write(Integer.toString(SnipSpaceFactory.getInstance().getSnipCount())); 57 } else { 58 throw new IllegalArgumentException ("Number of arguments does not match"); 59 } 60 } 61 } 62 | Popular Tags |