001: /* ===========================================================================
002: * $RCSfile: RgsEntry.java,v $
003: * ===========================================================================
004: *
005: * RetroGuard -- an obfuscation package for Java classfiles.
006: *
007: * Copyright (c) 1998-2006 Mark Welsh (markw@retrologic.com)
008: *
009: * This program can be redistributed and/or modified under the terms of the
010: * Version 2 of the GNU General Public License as published by the Free
011: * Software Foundation.
012: *
013: * This program is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: * GNU General Public License for more details.
017: *
018: */
019:
020: package COM.rl.obf;
021:
022: import java.io.*;
023: import java.util.*;
024:
025: /**
026: * Representation of RGS script files entry.
027: *
028: * @author Mark Welsh
029: */
030: public class RgsEntry {
031: // Constants -------------------------------------------------------------
032: public static final int TYPE_OPTION = 0;
033: public static final int TYPE_ATTR = 1;
034: public static final int TYPE_CLASS = 2;
035: public static final int TYPE_NOTRIM_CLASS = 3;
036: public static final int TYPE_NOT_CLASS = 4;
037: public static final int TYPE_FIELD = 5;
038: public static final int TYPE_NOTRIM_FIELD = 6;
039: public static final int TYPE_NOT_FIELD = 7;
040: public static final int TYPE_METHOD = 8;
041: public static final int TYPE_NOTRIM_METHOD = 9;
042: public static final int TYPE_NOT_METHOD = 10;
043: public static final int TYPE_PACKAGE_MAP = 11;
044: public static final int TYPE_REPACKAGE_MAP = 12;
045: public static final int TYPE_CLASS_MAP = 13;
046: public static final int TYPE_FIELD_MAP = 14;
047: public static final int TYPE_METHOD_MAP = 15;
048: public static final int TYPE_NOWARN = 16;
049:
050: // Fields ----------------------------------------------------------------
051: public int type;
052: public String name;
053: public String descriptor;
054: public String extendsName;
055: public String obfName;
056: public boolean retainToPublic;
057: public boolean retainToProtected;
058: public boolean retainPubProtOnly;
059: public boolean retainFieldsOnly;
060: public boolean retainMethodsOnly;
061: public boolean retainAndClass;
062: public int accessMask;
063: public int accessSetting;
064:
065: // Instance Methods-------------------------------------------------------
066: public RgsEntry(int type, String name) {
067: this .type = type;
068: this .name = name;
069: }
070:
071: public RgsEntry(int type, String name, String descriptor) {
072: this .type = type;
073: this .name = name;
074: this .descriptor = descriptor;
075: }
076:
077: public String toString() {
078: return name;
079: }
080:
081: public String debugString() {
082: return (type == TYPE_OPTION ? ".option "
083: : (type == TYPE_ATTR ? ".attribute "
084: : (type == TYPE_CLASS ? ".class "
085: : (type == TYPE_NOTRIM_CLASS ? "^class "
086: : (type == TYPE_NOT_CLASS ? "!class "
087: : (type == TYPE_METHOD ? ".method "
088: : (type == TYPE_NOTRIM_METHOD ? "^method "
089: : (type == TYPE_NOT_METHOD ? "!method "
090: : (type == TYPE_FIELD ? ".field "
091: : (type == TYPE_NOTRIM_FIELD ? "^field "
092: : (type == TYPE_NOT_FIELD ? "!field "
093: : (type == TYPE_PACKAGE_MAP ? ".package_map "
094: : (type == TYPE_REPACKAGE_MAP ? ".repackage_map "
095: : (type == TYPE_CLASS_MAP ? ".class_map "
096: : (type == TYPE_METHOD_MAP ? ".method_map "
097: : (type == TYPE_FIELD_MAP ? ".field_map "
098: : (type == TYPE_NOWARN ? ".nowarn "
099: : "")))))))))))))))))
100: + name
101: + " "
102: + (descriptor != null ? descriptor + " " : "")
103: + (retainToPublic ? "public " : "")
104: + (retainToProtected ? "protected " : "")
105: + (retainPubProtOnly ? "pub_prot_only " : "")
106: + (retainFieldsOnly ? "field " : "")
107: + (retainMethodsOnly ? "method " : "")
108: + (retainAndClass ? "and_class " : "")
109: + (extendsName != null ? "extends " + extendsName : "");
110: }
111: }
|