MappingProcessor.java revision cfead78069f3dc32998dc118ee08cab3867acea2
1/*
2 * ProGuard -- shrinking, optimization, obfuscation, and preverification
3 *             of Java bytecode.
4 *
5 * Copyright (c) 2002-2011 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.obfuscate;
22
23
24/**
25 * This interface specifies methods to process name mappings between original
26 * classes and their obfuscated versions. The mappings are typically read
27 * from a mapping file.
28 *
29 * @see MappingReader
30 *
31 * @author Eric Lafortune
32 */
33public interface MappingProcessor
34{
35    /**
36     * Processes the given class name mapping.
37     *
38     * @param className    the original class name.
39     * @param newClassName the new class name.
40     * @return whether the processor is interested in receiving mappings of the
41     *         class members of this class.
42     */
43    public boolean processClassMapping(String className,
44                                       String newClassName);
45
46    /**
47     * Processes the given field name mapping.
48     *
49     * @param className    the original class name.
50     * @param fieldType    the original external field type.
51     * @param fieldName    the original field name.
52     * @param newFieldName the new field name.
53     */
54    public void processFieldMapping(String className,
55                                    String fieldType,
56                                    String fieldName,
57                                    String newFieldName);
58
59    /**
60     * Processes the given method name mapping.
61     *
62     * @param className        the original class name.
63     * @param firstLineNumber  the first line number of the method, or 0 if it
64     *                         is not known.
65     * @param lastLineNumber   the last line number of the method, or 0 if it
66     *                         is not known.
67     * @param methodReturnType the original external method return type.
68     * @param methodName       the original external method name.
69     * @param methodArguments  the original external method arguments.
70     * @param newMethodName    the new method name.
71     */
72    public void processMethodMapping(String className,
73                                     int    firstLineNumber,
74                                     int    lastLineNumber,
75                                     String methodReturnType,
76                                     String methodName,
77                                     String methodArguments,
78                                     String newMethodName);
79}
80