1 17 18 package org.pentaho.core.solution; 19 20 import java.io.*; 21 import java.util.*; 22 23 public class OutputDef implements IOutputDef { 24 25 private String type; 26 27 private String name; 28 29 private boolean isList; 30 31 private Object value; 32 33 public OutputDef(String name, OutputStream outputStream) { 34 this.name = name; 35 isList = false; 36 type = "content"; value = outputStream; 38 } 39 40 public OutputDef(String name, List list) { 41 this.name = name; 42 isList = true; 43 type = "list"; value = list; 45 } 46 47 public OutputDef(String name, String type) { 48 this.name = name; 49 this.type = type; 50 isList = false; 51 } 52 53 58 public String getType() { 59 return type; 60 } 61 62 67 public String getName() { 68 return name; 69 } 70 71 76 public boolean isList() { 77 return isList; 79 } 80 81 86 public void setValue(Object value) { 87 if (!"content".equals(type) && !"list".equals(type)) { this.value = value; 89 } 90 } 91 92 97 public OutputStream getOutputStream() { 98 if ("content".equals(type)) { return (OutputStream) value; 101 } 102 return null; 103 } 104 105 public void addToList(Object listItem) { 106 if ("list".equals(type)) { ((List) value).add(listItem); 108 } 109 } 110 111 } 112 | Popular Tags |