java中的java / lang / String是什么样的结构?

时间:2013-09-21 08:13:17

标签: java eclipse java.lang.class

我使用Java Decompiler

反编译一个文件

我在我的代码中找到了这样的行,如下所示

   arg = remoteActionArgument.getDataType().getJavaDataType().getConstructor(new Class[] {
                    java/lang/String
                }).newInstance(new Object[] {
                    strArg
                });

在这里,我看到这样的 java / lang / String

我无法理解,这个结构究竟是什么。

有任何建议吗?

我尝试了以下内容

* 1. import java.lang。; *

2.更改此行以了解调用的位置,但除了此类代码外,我什么都没找到,另一个类文件

package org.itolab.morihit.clinkx;

import java.util.*;

public abstract class UPnPDataType extends Enum
{

    public static final UPnPDataType UI1;
    public static final UPnPDataType UI2;
    public static final UPnPDataType UI4;
    public static final UPnPDataType I1;
    public static final UPnPDataType I2;
    public static final UPnPDataType I4;
    public static final UPnPDataType INT;
    public static final UPnPDataType R4;
    public static final UPnPDataType R8;
    public static final UPnPDataType NUMBER;
    public static final UPnPDataType FIXED_14_4;
    public static final UPnPDataType FLOAT;
    public static final UPnPDataType CHAR;
    public static final UPnPDataType STRING;
    public static final UPnPDataType DATE;
    public static final UPnPDataType DATETIME;
    public static final UPnPDataType DATETIME_TZ;
    public static final UPnPDataType TIME;
    public static final UPnPDataType TIME_TZ;
    public static final UPnPDataType BOOLEAN;
    public static final UPnPDataType BIN_BASE64;
    public static final UPnPDataType BIN_HEX;
    public static final UPnPDataType URI;
    public static final UPnPDataType UUID;
    private static final Map map;
    private final String name;
    private static final UPnPDataType $VALUES[];

    public static UPnPDataType[] values()
    {
        return (UPnPDataType[])$VALUES.clone();
    }

    public static UPnPDataType valueOf(String name)
    {
        return (UPnPDataType)Enum.valueOf(org/itolab/morihit/clinkx/UPnPDataType, name);
    }

    static UPnPDataType get(String name)
    {
        return (UPnPDataType)map.get(name);
    }

    private UPnPDataType(String s, int i, String name)
    {
        super(s, i);
        this.name = name;
    }

    public String toString()
    {
        return name;
    }

    public Class getJavaDataType()
    {
        throw new UnsupportedOperationException();
    }

    abstract Object upnpStringToJavaObject(String s);

    abstract String javaObjectToUpnpString(Object obj);

    static Object booleanUpnpStringToJavaObject(String value)
    {
        if(value == null || value.equals("0"))
        {
            return Boolean.FALSE;
        } else
        {
            return Boolean.TRUE;
        }
    }

    static String booleanJavaObjectToUpnpString(Object value)
    {
        if(value == null || java/lang/Boolean != value.getClass() || value.equals(Boolean.FALSE))
        {
            return "0";
        } else
        {
            return "1";
        }
    }

    static Object integerUpnpStringToJavaObject(String value)
    {
        return new Integer(value);
        NumberFormatException e;
        e;
        return Integer.valueOf(0);
    }

    static String integerJavaObjectToUpnpString(Object value)
    {
        if(value == null || java/lang/Integer != value.getClass())
        {
            return "0";
        } else
        {
            return value.toString();
        }
    }

    static Object longUpnpStringToJavaObject(String value)
    {
        return new Long(value);
        NumberFormatException e;
        e;
        return Long.valueOf(0L);
    }

    static String longJavaObjectToUpnpString(Object value)
    {
        if(value == null || java/lang/Long != value.getClass())
        {
            return "0";
        } else
        {
            return value.toString();
        }
    }

    static Object floatUpnpStringToJavaObject(String value)
    {
        return new Float(value);
        NumberFormatException e;
        e;
        return new Float(0.0F);
    }

    static String floatJavaObjectToUpnpString(Object value)
    {
        if(value == null || java/lang/Float != value.getClass())
        {
            return "0.0";
        } else
        {
            return value.toString();
        }
    }

    static Object doubleUpnpStringToJavaObject(String value)
    {
        return new Double(value);
        NumberFormatException e;
        e;
        return new Double(0.0D);
    }

    static String doubleJavaObjectToUpnpString(Object value)
    {
        if(value == null || java/lang/Double != value.getClass())
        {
            return "0.0";
        } else
        {
            return value.toString();
        }
    }

    static Object characterUpnpStringToJavaObject(String value)
    {
        if(value == null || value.length() != 1)
        {
            return Character.valueOf('\0');
        } else
        {
            return Character.valueOf(value.charAt(0));
        }
    }

    static String characterJavaObjectToUpnpString(Object value)
    {
        if(value == null || java/lang/Character != value.getClass())
        {
            return "\0";
        } else
        {
            return value.toString();
        }
    }


    static 
    {
        UI1 = new UPnPDataType("UI1", 0, "ui1") {

            public Class getJavaDataType()
            {
                return java/lang/Integer;
            }

            Object upnpStringToJavaObject(String value)
            {
                return integerUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return integerJavaObjectToUpnpString(value);
            }

        };
        UI2 = new UPnPDataType("UI2", 1, "ui2") {

            public Class getJavaDataType()
            {
                return java/lang/Integer;
            }

            Object upnpStringToJavaObject(String value)
            {
                return integerUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return integerJavaObjectToUpnpString(value);
            }

        };
        UI4 = new UPnPDataType("UI4", 2, "ui4") {

            public Class getJavaDataType()
            {
                return java/lang/Long;
            }

            Object upnpStringToJavaObject(String value)
            {
                return longUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return longJavaObjectToUpnpString(value);
            }

        };
        I1 = new UPnPDataType("I1", 3, "i1") {

            public Class getJavaDataType()
            {
                return java/lang/Integer;
            }

            Object upnpStringToJavaObject(String value)
            {
                return integerUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return integerJavaObjectToUpnpString(value);
            }

        };
        I2 = new UPnPDataType("I2", 4, "i2") {

            public Class getJavaDataType()
            {
                return java/lang/Integer;
            }

            Object upnpStringToJavaObject(String value)
            {
                return integerUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return integerJavaObjectToUpnpString(value);
            }

        };
        I4 = new UPnPDataType("I4", 5, "i4") {

            public Class getJavaDataType()
            {
                return java/lang/Integer;
            }

            Object upnpStringToJavaObject(String value)
            {
                return integerUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return integerJavaObjectToUpnpString(value);
            }

        };
        INT = new UPnPDataType("INT", 6, "int") {

            public Class getJavaDataType()
            {
                return java/lang/Integer;
            }

            Object upnpStringToJavaObject(String value)
            {
                return integerUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return integerJavaObjectToUpnpString(value);
            }

        };
        R4 = new UPnPDataType("R4", 7, "r4") {

            public Class getJavaDataType()
            {
                return java/lang/Float;
            }

            Object upnpStringToJavaObject(String value)
            {
                return floatUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return floatJavaObjectToUpnpString(value);
            }

        };
        R8 = new UPnPDataType("R8", 8, "r8") {

            public Class getJavaDataType()
            {
                return java/lang/Double;
            }

            Object upnpStringToJavaObject(String value)
            {
                return doubleUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return doubleJavaObjectToUpnpString(value);
            }

        };
        NUMBER = new UPnPDataType("NUMBER", 9, "number") {

            public Class getJavaDataType()
            {
                return java/lang/Double;
            }

            Object upnpStringToJavaObject(String value)
            {
                return doubleUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return doubleJavaObjectToUpnpString(value);
            }

        };
        FIXED_14_4 = new UPnPDataType("FIXED_14_4", 10, "fixed.14.4") {

            public Class getJavaDataType()
            {
                return java/lang/Double;
            }

            Object upnpStringToJavaObject(String value)
            {
                return doubleUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return doubleJavaObjectToUpnpString(value);
            }

        };
        FLOAT = new UPnPDataType("FLOAT", 11, "float") {

            public Class getJavaDataType()
            {
                return java/lang/Float;
            }

            Object upnpStringToJavaObject(String value)
            {
                return floatUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return floatJavaObjectToUpnpString(value);
            }

        };
        CHAR = new UPnPDataType("CHAR", 12, "char") {

            public Class getJavaDataType()
            {
                return java/lang/Character;
            }

            Object upnpStringToJavaObject(String value)
            {
                return characterUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return characterJavaObjectToUpnpString(value);
            }

        };
        STRING = new UPnPDataType("STRING", 13, "string") {

            public Class getJavaDataType()
            {
                return java/lang/String;
            }

            Object upnpStringToJavaObject(String value)
            {
                if(value == null)
                {
                    return "";
                } else
                {
                    return value;
                }
            }

            String javaObjectToUpnpString(Object value)
            {
                if(value == null || java/lang/String != value.getClass())
                {
                    return "";
                } else
                {
                    return (String)value;
                }
            }

        };
        DATE = new UPnPDataType("DATE", 14, "date") {

            public Class getJavaDataType()
            {
                return java/util/Date;
            }

            Object upnpStringToJavaObject(String value)
            {
                throw new RuntimeException("not implemented yet");
            }

            String javaObjectToUpnpString(Object value)
            {
                throw new RuntimeException("not implemented yet");
            }

        };
        DATETIME = new UPnPDataType("DATETIME", 15, "dateTime") {

            public Class getJavaDataType()
            {
                return java/util/Date;
            }

            Object upnpStringToJavaObject(String value)
            {
                throw new RuntimeException("not implemented yet");
            }

            String javaObjectToUpnpString(Object value)
            {
                throw new RuntimeException("not implemented yet");
            }

        };
        DATETIME_TZ = new UPnPDataType("DATETIME_TZ", 16, "dateTime.tz") {

            public Class getJavaDataType()
            {
                return java/util/Date;
            }

            Object upnpStringToJavaObject(String value)
            {
                throw new RuntimeException("not implemented yet");
            }

            String javaObjectToUpnpString(Object value)
            {
                throw new RuntimeException("not implemented yet");
            }

        };
        TIME = new UPnPDataType("TIME", 17, "time") {

            public Class getJavaDataType()
            {
                return java/lang/Long;
            }

            Object upnpStringToJavaObject(String value)
            {
                throw new RuntimeException("not implemented yet");
            }

            String javaObjectToUpnpString(Object value)
            {
                throw new RuntimeException("not implemented yet");
            }

        };
        TIME_TZ = new UPnPDataType("TIME_TZ", 18, "time.tz") {

            public Class getJavaDataType()
            {
                return java/lang/Long;
            }

            Object upnpStringToJavaObject(String value)
            {
                throw new RuntimeException("not implemented yet");
            }

            String javaObjectToUpnpString(Object value)
            {
                throw new RuntimeException("not implemented yet");
            }

        };
        BOOLEAN = new UPnPDataType("BOOLEAN", 19, "boolean") {

            public Class getJavaDataType()
            {
                return java/lang/Boolean;
            }

            Object upnpStringToJavaObject(String value)
            {
                return booleanUpnpStringToJavaObject(value);
            }

            String javaObjectToUpnpString(Object value)
            {
                return booleanJavaObjectToUpnpString(value);
            }

        };
        BIN_BASE64 = new UPnPDataType("BIN_BASE64", 20, "bin.base64") {

            public Class getJavaDataType()
            {
                return (new byte[0]).getClass();
            }

            Object upnpStringToJavaObject(String value)
            {
                throw new RuntimeException("not implemented yet");
            }

            String javaObjectToUpnpString(Object value)
            {
                throw new RuntimeException("not implemented yet");
            }

        };
        BIN_HEX = new UPnPDataType("BIN_HEX", 21, "bin.hex") {

            public Class getJavaDataType()
            {
                return (new byte[0]).getClass();
            }

            Object upnpStringToJavaObject(String value)
            {
                throw new RuntimeException("not implemented yet");
            }

            String javaObjectToUpnpString(Object value)
            {
                throw new RuntimeException("not implemented yet");
            }

        };
        URI = new UPnPDataType("URI", 22, "uri") {

            public Class getJavaDataType()
            {
                return java/lang/String;
            }

            Object upnpStringToJavaObject(String value)
            {
                if(value == null)
                {
                    return "";
                } else
                {
                    return value;
                }
            }

            String javaObjectToUpnpString(Object value)
            {
                if(value == null || java/lang/String != value.getClass())
                {
                    return "";
                } else
                {
                    return (String)value;
                }
            }

        };
        UUID = new UPnPDataType("UUID", 23, "uuid") {

            public Class getJavaDataType()
            {
                return java/lang/String;
            }

            Object upnpStringToJavaObject(String value)
            {
                if(value == null)
                {
                    return "";
                } else
                {
                    return value;
                }
            }

            String javaObjectToUpnpString(Object value)
            {
                if(value == null || java/lang/String != value.getClass())
                {
                    return "";
                } else
                {
                    return (String)value;
                }
            }

        };
        $VALUES = (new UPnPDataType[] {
            UI1, UI2, UI4, I1, I2, I4, INT, R4, R8, NUMBER, 
            FIXED_14_4, FLOAT, CHAR, STRING, DATE, DATETIME, DATETIME_TZ, TIME, TIME_TZ, BOOLEAN, 
            BIN_BASE64, BIN_HEX, URI, UUID
        });
        Map _map = new HashMap();
        UPnPDataType arr$[] = values();
        int len$ = arr$.length;
        for(int i$ = 0; i$ < len$; i$++)
        {
            UPnPDataType type = arr$[i$];
            _map.put(type.toString(), type);
        }

        map = Collections.unmodifiableMap(_map);
    }
}

java中这样的java / lang / ....结构如何,需要帮助

由于

2 个答案:

答案 0 :(得分:2)

在您的代码中替换:

.getConstructor(new Class[] { java/lang/String }) ...

使用:

getConstructor(new Class[] { String.class }) ...

符号java/lang/String是类String名称的内部表示。无需明确import java.lang.*;,它是隐式导入的。

答案 1 :(得分:1)

您的反编译器正在添加 java / lang / (不确定您使用的是哪个反编译器)。 如果要编译源代码。删除src中的所有java/lang/。无需导入任何默认情况下导入的java.lang。