1/* 2 * ProGuard -- shrinking, optimization, obfuscation, and preverification 3 * of Java bytecode. 4 * 5 * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by the Free 9 * Software Foundation; either version 2 of the License, or (at your option) 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 * more details. 16 * 17 * You should have received a copy of the GNU General Public License along 18 * with this program; if not, write to the Free Software Foundation, Inc., 19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21package proguard; 22 23import java.io.*; 24import java.util.List; 25 26 27/** 28 * This class represents an entry from a class path: a jar, a war, a zip, an 29 * ear, or a directory, with a name and a flag to indicates whether the entry is 30 * an input entry or an output entry. Optional filters can be specified for the 31 * names of the contained resource/classes, jars, wars, ears, and zips. 32 * 33 * @author Eric Lafortune 34 */ 35public class ClassPathEntry 36{ 37 private File file; 38 private boolean output; 39 private List filter; 40 private List jarFilter; 41 private List warFilter; 42 private List earFilter; 43 private List zipFilter; 44 45 46 /** 47 * Creates a new ClassPathEntry with the given name and type. 48 */ 49 public ClassPathEntry(File file, boolean isOutput) 50 { 51 this.file = file; 52 this.output = isOutput; 53 } 54 55 56 /** 57 * Returns the path name of the entry. 58 */ 59 public String getName() 60 { 61 try 62 { 63 return file.getCanonicalPath(); 64 } 65 catch (IOException ex) 66 { 67 return file.getPath(); 68 } 69 } 70 71 72 public File getFile() 73 { 74 return file; 75 } 76 77 78 public void setFile(File file) 79 { 80 this.file = file; 81 } 82 83 84 public boolean isOutput() 85 { 86 return output; 87 } 88 89 90 public void setOutput(boolean output) 91 { 92 this.output = output; 93 } 94 95 96 public List getFilter() 97 { 98 return filter; 99 } 100 101 public void setFilter(List filter) 102 { 103 this.filter = filter == null || filter.size() == 0 ? null : filter; 104 } 105 106 107 public List getJarFilter() 108 { 109 return jarFilter; 110 } 111 112 public void setJarFilter(List filter) 113 { 114 this.jarFilter = filter == null || filter.size() == 0 ? null : filter; 115 } 116 117 118 public List getWarFilter() 119 { 120 return warFilter; 121 } 122 123 public void setWarFilter(List filter) 124 { 125 this.warFilter = filter == null || filter.size() == 0 ? null : filter; 126 } 127 128 129 public List getEarFilter() 130 { 131 return earFilter; 132 } 133 134 public void setEarFilter(List filter) 135 { 136 this.earFilter = filter == null || filter.size() == 0 ? null : filter; 137 } 138 139 140 public List getZipFilter() 141 { 142 return zipFilter; 143 } 144 145 public void setZipFilter(List filter) 146 { 147 this.zipFilter = filter == null || filter.size() == 0 ? null : filter; 148 } 149} 150