rt/vm/src/main/java/org/apidesign/vm4brwsr/ObfuscationDelegate.java
author Lubomir Nerad <lubomir.nerad@oracle.com>
Thu, 21 Mar 2013 18:48:46 +0100
branchclosure
changeset 869 151f4ccd7673
permissions -rw-r--r--
Initial attempt for advanced obfuscation
lubomir@869
     1
/**
lubomir@869
     2
 * Back 2 Browser Bytecode Translator
lubomir@869
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
lubomir@869
     4
 *
lubomir@869
     5
 * This program is free software: you can redistribute it and/or modify
lubomir@869
     6
 * it under the terms of the GNU General Public License as published by
lubomir@869
     7
 * the Free Software Foundation, version 2 of the License.
lubomir@869
     8
 *
lubomir@869
     9
 * This program is distributed in the hope that it will be useful,
lubomir@869
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
lubomir@869
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
lubomir@869
    12
 * GNU General Public License for more details.
lubomir@869
    13
 *
lubomir@869
    14
 * You should have received a copy of the GNU General Public License
lubomir@869
    15
 * along with this program. Look for COPYING file in the top folder.
lubomir@869
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
lubomir@869
    17
 */
lubomir@869
    18
package org.apidesign.vm4brwsr;
lubomir@869
    19
lubomir@869
    20
import java.io.IOException;
lubomir@869
    21
import org.apidesign.vm4brwsr.ByteCodeParser.ClassData;
lubomir@869
    22
import org.apidesign.vm4brwsr.ByteCodeParser.FieldData;
lubomir@869
    23
import org.apidesign.vm4brwsr.ByteCodeParser.MethodData;
lubomir@869
    24
lubomir@869
    25
abstract class ObfuscationDelegate {
lubomir@869
    26
    static ObfuscationDelegate NULL =
lubomir@869
    27
            new ObfuscationDelegate() {
lubomir@869
    28
                @Override
lubomir@869
    29
                public void exportJSProperty(Appendable out,
lubomir@869
    30
                                             String destObject,
lubomir@869
    31
                                             String propertyName)
lubomir@869
    32
                            throws IOException {
lubomir@869
    33
                }
lubomir@869
    34
lubomir@869
    35
                @Override
lubomir@869
    36
                public void exportClass(Appendable out,
lubomir@869
    37
                                        String destObject,
lubomir@869
    38
                                        String mangledName,
lubomir@869
    39
                                        ClassData classData)
lubomir@869
    40
                                            throws IOException {
lubomir@869
    41
                }
lubomir@869
    42
lubomir@869
    43
                @Override
lubomir@869
    44
                public void exportMethod(Appendable out,
lubomir@869
    45
                                         String destObject,
lubomir@869
    46
                                         String mangledName,
lubomir@869
    47
                                         MethodData methodData)
lubomir@869
    48
                                             throws IOException {
lubomir@869
    49
                }
lubomir@869
    50
lubomir@869
    51
                @Override
lubomir@869
    52
                public void exportField(Appendable out,
lubomir@869
    53
                                        String destObject,
lubomir@869
    54
                                        String mangledName,
lubomir@869
    55
                                        FieldData fieldData)
lubomir@869
    56
                                            throws IOException {
lubomir@869
    57
                }
lubomir@869
    58
            };
lubomir@869
    59
lubomir@869
    60
    public abstract void exportJSProperty(
lubomir@869
    61
            Appendable out, String destObject, String propertyName)
lubomir@869
    62
                throws IOException;
lubomir@869
    63
lubomir@869
    64
    public abstract void exportClass(
lubomir@869
    65
            Appendable out, String destObject, String mangledName,
lubomir@869
    66
            ClassData classData) throws IOException;
lubomir@869
    67
lubomir@869
    68
    public abstract void exportMethod(
lubomir@869
    69
            Appendable out, String destObject, String mangledName,
lubomir@869
    70
            MethodData methodData) throws IOException;
lubomir@869
    71
lubomir@869
    72
    public abstract void exportField(
lubomir@869
    73
            Appendable out, String destObject, String mangledName,
lubomir@869
    74
            FieldData fieldData) throws IOException;
lubomir@869
    75
}