ここで、TP_DSCVoyChange クラスには属性として、コンストラクター
を使用して文字列値を使用して Java からKEY_DSC
この値を入力する必要があります。例えば。KEY_DSC
TP_DSCVoyChange
voyagelist.addElement(new TP_DSCVoyChange(dscDetails.strDscKey,dscDetails.voyage));
dscDetails.strDscKey
しかし、型ではなく文字列であるというエラーが発生しますKEY_DSC
。
修正方法を教えてください。
public final class TP_DSCVoyChange implements IDLEntity
{
public KEY_DSC key;
public String voyNumbers[];
private transient Hashtable _printMap;
private transient Hashtable _cmpMap;
public TP_DSCVoyChange()
{
_printMap = null;
_cmpMap = null;
}
public TP_DSCVoyChange(KEY_DSC key_dsc, String as[])
{
_printMap = null;
_cmpMap = null;
key = key_dsc;
voyNumbers = as;
}
public String toString()
{
StringBuffer stringbuffer = new StringBuffer("struct idl.TP_DSCVoyChange {");
Thread thread = Thread.currentThread();
boolean flag = false;
if(_printMap == null)
{
synchronized(this)
{
if(_printMap == null)
{
flag = true;
_printMap = new Hashtable();
}
}
}
if(!flag && _printMap.get(thread) != null)
{
stringbuffer.append("...}");
return stringbuffer.toString();
}
_printMap.put(thread, this);
stringbuffer.append("\n");
stringbuffer.append("idl.KEY_DSC key=");
stringbuffer.append(key);
stringbuffer.append(",\n");
stringbuffer.append("java.lang.String[] voyNumbers=");
stringbuffer.append("{");
if(voyNumbers == null)
{
stringbuffer.append(voyNumbers);
} else
{
for(int i = 0; i < voyNumbers.length; i++)
{
stringbuffer.append(voyNumbers[i] == null ? null : (new StringBuilder()).append('"').append(voyNumbers[i]).append('"').toString());
if(i < voyNumbers.length - 1)
{
stringbuffer.append(",");
}
}
}
stringbuffer.append("}");
stringbuffer.append("\n");
_printMap.remove(thread);
stringbuffer.append("}");
return stringbuffer.toString();
}
public boolean equals(Object obj)
{
if(this == obj)
{
return true;
}
if(obj == null)
{
return false;
}
Thread thread = Thread.currentThread();
boolean flag = false;
if(_cmpMap == null)
{
synchronized(this)
{
if(_cmpMap == null)
{
flag = true;
_cmpMap = new Hashtable();
}
}
}
if(!flag)
{
Object obj1 = _cmpMap.get(thread);
if(obj1 != null)
{
return obj == obj1;
}
}
if(obj instanceof TP_DSCVoyChange)
{
_cmpMap.put(thread, obj);
TP_DSCVoyChange tp_dscvoychange1 = (TP_DSCVoyChange)obj;
boolean flag1 = true;
flag1 = key == tp_dscvoychange1.key || key != null && tp_dscvoychange1.key != null && key.equals(tp_dscvoychange1.key);
if(flag1 && (flag1 = voyNumbers.length == tp_dscvoychange1.voyNumbers.length))
{
for(int i = 0; flag1 && i < voyNumbers.length; i++)
{
flag1 = voyNumbers[i] == tp_dscvoychange1.voyNumbers[i] || voyNumbers[i] != null && tp_dscvoychange1.voyNumbers[i] != null && voyNumbers[i].equals(tp_dscvoychange1.voyNumbers[i]);
}
}
_cmpMap.remove(thread);
return flag1;
} else
{
return false;
}
}
}
public final class KEY_DSC implements IDLEntity
{
public int dsc;
public KEY_DSC()
{
}
public KEY_DSC(int i)
{
dsc = i;
}
public String toString()
{
StringBuffer stringbuffer = new StringBuffer("struct idl.KEY_DSC {");
stringbuffer.append("\n");
stringbuffer.append("int dsc=");
stringbuffer.append(dsc);
stringbuffer.append("\n");
stringbuffer.append("}");
return stringbuffer.toString();
}
public boolean equals(Object obj)
{
if(this == obj)
{
return true;
}
if(obj == null)
{
return false;
}
if(obj instanceof KEY_DSC)
{
KEY_DSC key_dsc = (KEY_DSC)obj;
boolean flag = true;
flag = dsc == key_dsc.dsc;
return flag;
} else
{
return false;
}
}
}