The error is always that the dino cannot be converted into type string
however im struggling to understand why the compiler would think of trying to
converting dino into ints or strings from the first method
public static void Tyrannosaurus()
{
String DinoName = Name();
Dinosaur Tyrannosaurus = new Dinosaur();
Tyrannosaurus.name = DinoName;
Tyrannosaurus = setDiet(Tyrannosaurus, DinoDiet[0]);
Tyrannosaurus = setHP(Tyrannosaurus, 100);
Tyrannosaurus = setDamage(Tyrannosaurus, 200);
DaysLoop(DinoName);
return;
}
Here is the first getter method being used for the Dinosaur record and Tyrannosaurus instance above
public static String getName (Dinosaur dino)
{
return Tyrannosaurus.name;
}
public static String getDiet (Dinosaur dino)
{
return Tyrannosaurus.diet;
}
public static int getHP (Dinosaur dino)
{
return dino.HP;
}
public static int getDamage (Dinosaur dino)
{
return dino.damage;
}
setter method which does not work is done from here, I do see in other java setters people use this. but I havent quite grasped that concept yet
public static String setDiet (Dinosaur dino, String TyranDiet)
{
dino.diet = TyranDiet;
return dino;
}
public static int setHP (Dinosaur dino, int TyranHP)
{
dino.HP = TyranHP;
return dino;
}
public static int setDamage (Dinosaur dino, int TyranDamage)
{
dino.damage = TyranDamage;
return dino;
}
//////////////////////////////////
You return dino as string and dino as an int in below methods.
public static String setDiet (Dinosaur dino, String TyranDiet);
public static int setHP (Dinosaur dino, int TyranHP);
public static int setDamage (Dinosaur dino, int TyranDamage);
that's why its pops error like that
basically setters not returns anything. remove return and re-write code like this
public static void setDiet (Dinosaur dino, String TyranDiet)
{
dino.diet = TyranDiet;
}
public static void setHP (Dinosaur dino, int TyranHP)
{
dino.HP = TyranHP;
}
public static void setDamage (Dinosaur dino, int TyranDamage)
{
dino.damage = TyranDamage;
}
Related
I have this class called Training that extends the other 2 classes
public class Training{
public int workoutTime;
public String typeOfWorkout;
public Training(){
}
public Training(int workoutTime, String typeOfWorkout) {
this.workoutTime = workoutTime;
this.typeOfWorkout = typeOfWorkout;
}
public int getWorkoutTime() {
return workoutTime;
}
public String getTypeOfWorkout() {
return typeOfWorkout;
}
public class Anaerobic extends Training{
public int noOfSets;
public Anaerobic(int workoutTime, String typeOfWorkout, int noOfSets) {
super(workoutTime, ypeOfWorkout);
this.noOfSets = noOfSets;
}
public int getNoOfSets() {
return noOfSets;
}
public class Aerobic extends Training{
public Anaerobic(int workoutTime, String typeOfWorkout) {
super(workoutTime, ypeOfWorkout);
}
public static void main(String[] args) {
Anaerobic anaerobic = new Anaerobic(60, "Strength", 4);
Anaerobic anaerobic1 = new Anaerobic(75, "Strength", 6);
Anaerobic anaerobic2 = new Anaerobic(90, "Strength", 4);
Anaerobic anaerobic3 = new Anaerobic(60, "Strength", 5);
Aerobic aerobic = new Aerobic(60, "Cardio");
ArrayList<Training> list = new ArrayList<>();
list.add(anaerobic);
list.add(anaerobic1);
list.add(anaerobic2);
list.add(anaerobic3);
list.add(aerobic);
showList(list);
And now i have to make a new list and make it print object from either Anaerobic or Aerobic but i have to use the already generated list so i dont know how to do it.
I tried this.
ArrayList listAnaerobic = new ArrayList<>(list);
showListAnaerobic(listAnaerobic);
}
}
public static void showList(ArrayList<Training> lista) {
for (Training list : lista) {
System.out.println(list);
}
public static void showListAnaerobic(ArrayList<Anaerobic> lista) {
for (Anaerobic list : lista) {
System.out.println(list);
}
}
I'm doing a little project for school where I try to do a spreadsheet program, and I have two classes, I will be simplifying this with pseudocode a little bit so it's not too messy.
class DocumentController {
Document doc // This is a class with a CRUD on a document (It haves
// Sheets and every Sheet haves a Table full of Cells)
Parser p
getValueOfCell (sheetName, positionX, positionY) {
returns value of a cell in a sheet in the position x,y
}
setCell (String expression, sheetName, positionX, positionY) {
//Somewhere here we need to use p.evaluate()
}
}
class Parser {
DocumentController docController;
evaluate (expression: String) {
//Somewhere here, I need to use method getCell from Document
// for evaluating the expression (The expressions have
// references to other cells so the Parser need to resolve
// these references)
...
return value of the expression (float, integer, string, whatever)
}
}
So apparently my teacher said to me that this is a bad design, because these classes are too coupled and this is a code smell. Can someone explain me why is this so bad? How can I make a better design?
Thank you, sorry if I made some typos or the code is not legible
I think you want something like:
Class Main{
public void main(){
DocumentController dc = new DocumentController();
//you can get ahold of the parser by
Parser p = dc.getParser();
}
}
Class Parser{
DocumentController dc;
public Parser(DocumentController dc){
this.dc = dc;
}
//your methods
}
Class DocumentController{
Parser p;
public DocumentController(){
this.p = new Parser(this);
}
public Parser getParser(){
return this.p;
}
//your methods
}
Although there are probably better ways of doing this instead like passing your object to the method when you need it. Something like
Class Main{
public void main(){
DocumentController dc = new DocumentController();
Parser p = new Parser();
p.myParserMethod(dc);
dc.myDocMethod(p);
}
}
Class Parser{
public myParserMethod(DocumentController dc){
//you can use the same documentController object here
}
}
Class DocumentController{
public myDocMethod(Parser p){
//you can use your parser object here
}
}
hope that helps
It looks like you want to format value by some key expression. If yes, then we can create mapping between this key expression and format classes. Then we can use Factory pattern to create desired objects to format your cell value.
Let me show a simple example via C#.
So this is a DocumentController:
public class DocumentController
{
private DocumentService _documentService;
public DocumentController()
{
_documentService = new DocumentService(); // this dependency can be
// resolved by IoC container
}
public void GetValueCell(int docId, string sheetName, int positionX,
int positionY)
{
_documentService.GetValueCell(docId, sheetName, positionX,
positionY);
}
public void SetCell(int docId, string expression, string sheetName, int
positionX, int positionY, object value)
{
_documentService.SetCell(docId, expression, sheetName, positionX,
positionY, value);
}
}
And this is a service which will execute logic related to Document:
public class DocumentService
{
private DocumentRepository _documentRepository;
public DocumentService()
{
_documentRepository = new DocumentRepository();
}
public string GetValueCell(int docId, string sheetName, int positionX, int positionY)
{
Document document = _documentRepository.GetById(docId);
return document.GetCellValue(sheetName, positionX, positionY);
}
public void SetCell(int docId, string expression, string sheetName, int
positionX, int positionY, object value)
{
Document document = _documentRepository.GetById(docId);
document.SetCellValue(expression, sheetName, positionX, positionY,
value);
}
}
It is unknown how you get Document, but it is possible to use repository pattern for that purpose.
public class DocumentRepository
{
public Document GetById(int id) { throw new NotImplementedException(); }
}
and this is a Document class:
public class Document
{
private object[][] _cells;
public Document(int x)
{
_cells = new object[x][];
}
public string GetCellValue(string sheetName, int positionX, int positionY)
{
return string.Empty;
}
public void SetCellValue(string expression, string sheetName, int
positionX, int positionY, object value)
{
FormatterType formatterType = new
FormatterTypeToExpression().FormatterByExpression[expression];
Formatter formatter = new FormatterFactory().
FormatterByFormatterType[formatterType];
object formattedCell = formatter.Format(value);
_cells[positionX][positionY] = formattedCell;
}
}
and this is a mapping between FormatterType and your key expression:
public class FormatterTypeToExpression
{
public Dictionary<string, FormatterType> FormatterByExpression { get; set; } =
new Dictionary<string, FormatterType>
{
{ "string", FormatterType.String}
// here you write expressions and foramtters
};
}
This is a formatter type:
public enum FormatterType
{
String, Number, Decimal, Whatever
}
Then you need something like factory to take a formatter:
public abstract class Formatter
{
public abstract object Format(object value);
}
And abstract class which will define behavior of derived formatter classes:
public class FormatterString : Formatter
{
public override object Format(object value)
{
return "I am a formatted string value";
}
}
An example how FormatterFactory could look like:
public class FormatterFactory
{
public Dictionary<FormatterType, Formatter> FormatterByFormatterType { get; set; }
= new Dictionary<FormatterType, Formatter>
{
{ FormatterType.String, new FormatterString()}
// here you write FormatterType and formatters
};
}
I want create dynamic table with TableView class.
I send to contractor the number of columns (int), columns name (String[]) and rows (Student), but I can't deal with that.
How I need to define the TableColumn for each one of columns?
public class DynamicTable extends TableView<Student>{
private ObservableList<Student> data;
private int columnCount;
private String[] columnName;
private TableView<Student> tableView;
DynamicTable(){
}
DynamicTable(int columnCount, Student[] rows, String[] columnName){
this.columnName=columnName;
this.columnCount=columnCount;
data = FXCollections.observableArrayList();
setData(rows);
}
public void buildTable(){
for(int i=0 ; i<columnCount; i++){
final int j=i;
TableColumn<Student,String> col = new TableColumn<Student,String>(columnName[i]);
//col.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Student,String>, ObservableValue<String>>() {
//#Override
//public ObservableValue<String> call(
// CellDataFeatures<Student, String> param) {
// return new SimpleStringProperty(param.getValue().getAddress());
// }
//});
tableView.getColumns().addAll(col);
tableView.setItems(data);
}
}
public void setData(Student[] rows){
data.setAll(rows);
}
public String[] getColumnName(){
return this.columnName;
}
}
I be glad for receiving your answer.
Edit: Student class:
public class Student implements Externalizable
{
private final SimpleIntegerProperty ID;
private final SimpleStringProperty firstName;
private final SimpleStringProperty lastName;
private final SimpleStringProperty address;
private final SimpleObjectProperty<Date> birthDate;
private final SimpleStringProperty department;
private final SimpleIntegerProperty pointsAmount;
private final SimpleObjectProperty<Date> startStudyingDate;
private final SimpleIntegerProperty failedAmount;
private final SimpleDoubleProperty average;
private final SimpleIntegerProperty lavelByGrade;
private final SimpleStringProperty pic;
public Student(){
this.ID = new SimpleIntegerProperty();
this.firstName= new SimpleStringProperty();
this.lastName= new SimpleStringProperty();
this.address= new SimpleStringProperty();
this.birthDate= new SimpleObjectProperty<Date>();
this.department= new SimpleStringProperty();
this.pointsAmount= new SimpleIntegerProperty();
this.startStudyingDate= new SimpleObjectProperty<Date>();
this.failedAmount= new SimpleIntegerProperty();
this.average= new SimpleDoubleProperty();
this.lavelByGrade= new SimpleIntegerProperty();
this.pic = new SimpleStringProperty();
}
public Student(int ID, String firstName, String lastName, String address,
Date birthDate, String department,
int pointsAmount, Date startStudyingDate, int failedAmount,
double average, int lavelByGrade, String pic){
this.ID= new SimpleIntegerProperty(ID);
this.firstName= new SimpleStringProperty(firstName);
this.lastName= new SimpleStringProperty(lastName);
this.address= new SimpleStringProperty(address);
this.birthDate= new SimpleObjectProperty<Date>(birthDate);
this.department= new SimpleStringProperty(department);
this.pointsAmount= new SimpleIntegerProperty(pointsAmount);
this.startStudyingDate= new SimpleObjectProperty<Date>(startStudyingDate);
this.failedAmount= new SimpleIntegerProperty(failedAmount);
this.average= new SimpleDoubleProperty(average);
this.lavelByGrade= new SimpleIntegerProperty(lavelByGrade);
this.pic = new SimpleStringProperty(pic);
}
public int getID() {
return ID.get();
}
public void setID(int ID) {
this.ID.set(ID);
}
public String getFirstName() {
return firstName.get();
}
public void setFirstName(String firstName) {
this.firstName.set(firstName);
}
public String getLastName() {
return lastName.get();
}
public void setLastName(String lastName) {
this.lastName.set(lastName);
}
public String getAddress() {
return address.get();
}
public void setAddress(String address) {
this.address.set(address);
}
public Date getBirthDate() {
return birthDate.get();
}
public void setBirthDate(Date birthDate) {
this.birthDate.set(birthDate);
}
public String getDepartment() {
return department.get();
}
public void setDepartment(String department) {
this.department.set(department);
}
public int getPointsAmount() {
return pointsAmount.get();
}
public void setPointsAmount(int pointsAmount) {
this.pointsAmount.set(pointsAmount);
}
public Date getStartStudyingDate() {
return startStudyingDate.get();
}
public void setStartStudyingDate(Date startStudyingDate) {
this.startStudyingDate.set(startStudyingDate);
}
public int getFailedAmount() {
return failedAmount.get();
}
public void setFailedAmount(int failedAmount) {
this.failedAmount.set(failedAmount);
}
public double getAverage() {
return average.get();
}
public void setAverage(Double average) {
this.average.set(average);
}
public int getLavelByGrade() {
return lavelByGrade.get();
}
public void setLavelByGrade(int lavelByGrade) {
this.lavelByGrade.set(lavelByGrade);
}
public String getPic() {
return pic.get();
}
public void setPic(String pic) {
this.pic.set(pic);
}
#Override
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
setID(in.readInt());
setFirstName((String)in.readObject());
setLastName((String)in.readObject());
setAddress((String)in.readObject());
setBirthDate((Date)in.readObject());
setDepartment((String)in.readObject());
setPointsAmount(in.readInt());
setStartStudyingDate((Date)in.readObject());
setFailedAmount(in.readInt());
setAverage(in.readDouble());
setLavelByGrade(in.readInt());
setPic((String)in.readObject());
}
#Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(getID());
out.writeObject(getFirstName());
out.writeObject(getLastName());
out.writeObject(getAddress());
out.writeObject(getBirthDate());
out.writeObject(getDepartment());
out.writeInt(getPointsAmount());
out.writeObject(getStartStudyingDate());
out.writeInt(getFailedAmount());
out.writeDouble(getAverage());
out.writeInt(getLavelByGrade());
out.writeObject(getPic());
}
}
First, you need to add property accessor methods to your Student class:
public class Student {
private final SimpleStringProperty firstName ;
// etc ...
public String getFirstName() {
return firstName.get();
}
public void setFirstName(String firstName) {
this.firstName.set(firstName);
}
// Add methods like this:
public StringProperty firstNameProperty() {
return firstName ;
}
// ... etc
}
Then your cell value factory will look something like this:
TableColumn<Student,String> col = new TableColumn<Student,String>(columnName[i]);
col.setCellValueFactory(cellData -> {
Student student = cellData.getValue();
return student.xxxProperty();
});
Where you replace xxxProperty() with the actual property whose value you want to display in that column.
I'm using JNA to run a dll function:
Here is all the code corresponding to that manner:
The Native Declarations:
//how the method declared
H264_Login (char *sIP, unsigned short wPort, char *sUserName, char *sPassword, LP_DEVICEINFO lpDeviceInfo, int *error, ,SocketStyle socketTyle=TCPSOCKET); // where LP_DEVICEINFO is a struct
//how the struct declared
typedef struct _H264_DVR_DEVICEINFO
{
SDK_SYSTEM_TIME tmBuildTime; // the "SDK_SYSTEM_TIME" is another struct
char sSerialNumber[64];
int byChanNum;
unsigned int uiDeviceRunTime;
SDK_DeviceType deviceTye; // the "SDK_DeviceType" is a enum
}H264_DVR_DEVICEINFO,*LP_DEVICEINFO;
// this is how "SDK_SYSTEM_TIME" is defined
typedef struct SDK_SYSTEM_TIME{
int year;
int month;
int day;
}SDK_SYSTEM_TIME;
// this is how "SDK_DeviceType" is defined
enum SDK_DeviceType
{
SDK_DEVICE_TYPE_DVR,
SDK_DEVICE_TYPE_MVR,
SDK_DEVICE_TYPE_NR
};
// this is how "SocketStyle" is defined
enum SocketStyle
{
TCPSOCKET=0,
UDPSOCKET,
SOCKETNR
};
The following is their corresponding Java mappings:
public class Test implements StdCallLibrary {
public interface simpleDLL extends StdCallLibrary {
long H264_Login(String sIP, short wPort, String sUserName, String sPassword,
Structure DeviceDate, int error, int TCPSOCKET);
}
static
{
System.loadLibrary("NetSdk");
}
// the struct implementation
public static class DeviceDate extends Structure{
public SDK_SYSTEM_TIME tmBuildTime;
public String sSerialNumber;
public IntByReference byChanNum;
public IntByReference uiDeviceRunTime;
public IntByReference deviceTpye;
#Override
protected List<Object> getFieldOrder() {
List<Object> list = new ArrayList<>();
list.add("tmBuildTime");
list.add("sSerialNumber");
list.add("byChanNum");
list.add("uiDeviceRunTime");
list.add("deviceTpye");
return list;
}
}
public static class SDK_SYSTEM_TIME extends Structure{
public IntByReference year;
public IntByReference month;
public IntByReference day;
#Override
protected List<Object> getFieldOrder() {
List<Object> list = new ArrayList<>();
list.add("year");
list.add("month");
list.add("day");
return list;
}
}
// and then how I called it through the main function
public static void main(String args[]) throws FileNotFoundException{
simpleDLL INSTANCE = (simpleDLL) Native.loadLibrary( ("NetSdk"), simpleDLL.class);
DeviceDate dev = new DeviceDate() // where DeviceDate is a static class inherits com.sun.jna.Structure
int err = (int) INSTANCE.H264_GetLastError();
long result = INSTANCE.H264_Login("255.255.255.255", (short) 33333, "admin", "admin", dev, err, 0);
}
}
upon running the app, the Java crashes:
and this is the full problem signature:
Problem signature:
Problem Event Name: APPCRASH
Application Name: javaw.exe
Application Version: 7.0.600.19
Application Timestamp: 536a95c6
Fault Module Name: jna3976113557901128571.dll
Fault Module Version: 4.0.0.215
Fault Module Timestamp: 52d3949a
Exception Code: c0000005
Exception Offset: 0000e3a2 OS
Version: 6.1.7601.2.1.0.256.1
Locale ID: 1033
Additional Information 1: 7bc2
Additional Information 2: 7bc24d73a5063367529b81d28aecc01c
Additional Information 3: 5bea
Additional Information 4: 5beaa1c0441c3adb156a170a61c93d19
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our
privacy statement offline: C:\Windows\system32\en-US\erofflps.txt
Your mappings have a number of errors. Your structures should look like the following (IntByReference represents places where you would pass the address of an int, and you can't substitute String for a primitive native char array). Please refer to the JNA mapping documentation to ensure you understand how native types map to Java types:
public static class LP_DEVICE_INFO extends Structure{
public SDK_SYSTEM_TIME tmBuildTime;
public byte[] sSerialNumber = new byte[64];
public int byChanNum;
public int uiDeviceRunTime;
public int deviceType; // Assuming the size of the enum is int
#Override
protected List<Object> getFieldOrder() {
List<Object> list = new ArrayList<>();
list.add("tmBuildTime");
list.add("sSerialNumber");
list.add("byChanNum");
list.add("uiDeviceRunTime");
list.add("deviceTpye");
return list;
}
}
public static class SDK_SYSTEM_TIME extends Structure{
public int year;
public int month;
public int day;
#Override
protected List<Object> getFieldOrder() {
List<Object> list = new ArrayList<>();
list.add("year");
list.add("month");
list.add("day");
return list;
}
}
In JNA,how to map a complex union structure from follows c codes:
typedef struct {
char *vmxSpec;
char *serverName;
char *thumbPrint;
long privateUse;
VixDiskLibCredType credType;//enum type
union VixDiskLibCreds {
struct VixDiskLibUidPasswdCreds {
char *userName;
char *password;
} uid;
struct VixDiskLibSessionIdCreds {
char *cookie;
char *userName;
char *key;
} sessionId;
struct VixDiskLibTicketIdCreds *ticketId;
} creds;
uint32 port;
} VixDiskLibConnectParams;
when i mapping the struct,it throws a NullPointerException:
Exception in thread "Thread-56" java.lang.NullPointerException
at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:290)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:157)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:146)
at java.util.Arrays.sort(Arrays.java:472)
at java.util.Collections.sort(Collections.java:155)
at com.sun.jna.Structure.sort(Structure.java:889)
at com.sun.jna.Structure.getFields(Structure.java:921)
at com.sun.jna.Structure.deriveLayout(Structure.java:1054)
at com.sun.jna.Structure.calculateSize(Structure.java:978)
at com.sun.jna.Structure.calculateSize(Structure.java:945)
at com.sun.jna.Structure.allocateMemory(Structure.java:375)
at com.sun.jna.Structure.<init>(Structure.java:184)
at com.sun.jna.Structure.<init>(Structure.java:172)
at com.sun.jna.Structure.<init>(Structure.java:159)
at com.sun.jna.Structure.<init>(Structure.java:151)
at com.test.vmm.vdp.VixDiskLibrary$VixDiskLibConnectParams.<init>(VixDiskLibrary.java:71)
at com.test.vmm.vdp.VixDiskLibrary$VixDiskLibConnectParams$ByReference.<init>(VixDiskLibrary.java:72)
at com.test.vmm.vdp.VixDiskLib.run(VixDiskLib.java:47)
at java.lang.Thread.run(Thread.java:744)
my code as follows:
public static class VixDiskLibConnectParams extends Structure {
public static class ByReference extends VixDiskLibConnectParams implements Structure.ByReference {}
public static class ByValue extends VixDiskLibConnectParams implements Structure.ByValue {}
public static class VixDiskLibCreds extends Union {
public static class ByReference extends VixDiskLibCreds implements Structure.ByReference {}
public static class ByValue extends VixDiskLibCreds implements Structure.ByValue {}
public VixDiskLibUidPasswdCreds uid;
public VixDiskLibSessionIdCreds sessionId;
public VixDiskLibTicketIdCreds.ByReference ticketId;
public static class VixDiskLibUidPasswdCreds extends Structure {
public static class ByReference extends VixDiskLibUidPasswdCreds implements Structure.ByReference {}
public String userName;
public String password;
protected List getFieldOrder() {
List list = new ArrayList();
list.add(userName);
list.add(password);
return list;
}
}
public static class VixDiskLibSessionIdCreds extends Structure {
public static class ByReference extends VixDiskLibSessionIdCreds implements Structure.ByReference {}
public String cookie;
public String userName;
public String key;
protected List getFieldOrder() {
List list = new ArrayList();
list.add(cookie);
list.add(userName);
list.add(key);
return list;
}
}
public static class VixDiskLibTicketIdCreds extends Structure {
public static class ByReference extends VixDiskLibUidPasswdCreds implements Structure.ByReference {}
protected List getFieldOrder() {
List list = new ArrayList();
return list;
}
}
protected List getFieldOrder() {
List list = new ArrayList();
list.add(uid);
list.add(sessionId);
list.add(ticketId);
return list;
}
}
public String vmxSpec;
public String serverName;
public String thumbPrint;
public NativeLong privateUse;
public int credType;
public VixDiskLibCreds.ByValue creds;
public int port;
public void read() {
super.read();
switch (credType) {
case VixDiskLibCredType.VIXDISKLIB_CRED_UID:
creds.setType(VixDiskLibCreds.VixDiskLibUidPasswdCreds.class);
creds.read();
break;
case VixDiskLibCredType.VIXDISKLIB_CRED_SESSIONID:
creds.setType(VixDiskLibCreds.VixDiskLibSessionIdCreds.class);
creds.read();
break;
case VixDiskLibCredType.VIXDISKLIB_CRED_TICKETID:
creds.setType(VixDiskLibCreds.VixDiskLibTicketIdCreds.class);
creds.read();
break;
case VixDiskLibCredType.VIXDISKLIB_CRED_SSPI:
System.out.println("VixDiskLibCredType : VIXDISKLIB_CRED_SSPI");
break;
default:
System.out.println("VixDiskLibCredType : unknow");
break;
}
}
protected List getFieldOrder() {
List list = new ArrayList();
list.add(vmxSpec);
list.add(serverName);
list.add(thumbPrint);
list.add(privateUse);
list.add(credType);
list.add(creds);
list.add(port);
return list;
}
}
what's wrong?A clear explanation on how to do it will be better.
Thanks
i have found the problem, quotes are forgotten in the method add() when called to add element by List
The correct code will be:
protected List getFieldOrder() {
List list = new ArrayList();
list.add("userName");
list.add("password");
return list;
}