javaeclipsejava.lang.class

What kind of structure java/lang/String in java?


I decompiles one file, using Java Decompiler

I found such line in my code, as below

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

Here, I see like this java/lang/String

I am unable to understand it, what exactly this structure is.

Any Suggestion?

I tried following things

*** 1. import java.lang.;***

2.Change within this line to know where is call but I find nothing except such code, another classfile

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);
    }
}

How such java/lang/.... structure is in java, HELP NEEDED

Thanks


Solution

  • In your code replace:

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

    With:

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

    The notation java/lang/String is an internal representation of the name of the class String. No need to explicitly import java.lang.*;, it is imported implicitly.