1 23 24 package org.apache.slide.macro; 25 26 30 import java.util.HashMap ; 31 import java.util.Map ; 32 33 public class MacroParameters { 34 35 private static final String RECURSIVE = "recursive"; 36 private static final String OVERWRITE = "overwrite"; 37 private static final String DELETE_CREATE = "deleteCreate"; 38 39 private Map parameters = new HashMap (); 40 41 44 public MacroParameters() { 45 this(true, false); 46 } 47 48 54 public MacroParameters(boolean recursive, boolean overwrite) { 55 this(recursive, overwrite, overwrite); 56 } 57 58 67 public MacroParameters(boolean recursive, boolean overwrite, boolean deleteCreate) { 68 setBooleanParameter( RECURSIVE, recursive ); 69 setBooleanParameter( OVERWRITE, overwrite ); 70 setBooleanParameter( DELETE_CREATE, (overwrite && deleteCreate) ); 71 } 72 73 78 public boolean isRecursive() { 79 return getBooleanParameter( RECURSIVE ); 80 } 81 82 88 public boolean isOverwrite() { 89 return getBooleanParameter( OVERWRITE ); 90 } 91 92 99 public boolean isDeleteCreate() { 100 return getBooleanParameter( DELETE_CREATE ); 101 } 102 103 public void setParameter( String name, Object value ) { 104 parameters.put( name, value ); 105 } 106 107 public void setBooleanParameter( String name, boolean value ) { 108 parameters.put( name, new Boolean (value) ); 109 } 110 111 public Object getParameter( String name ) { 112 return parameters.get( name ); 113 } 114 115 public boolean getBooleanParameter( String name ) { 116 return ((Boolean )parameters.get(name)).booleanValue(); 117 } 118 } 119 | Popular Tags |