Class Struktur
hello, i want to add a calss to a hass
The Dataclass is this
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package my.config;
/**
*
* @author smiefert
*/
public class JConfigEntry {
Integer CID;
String ckey, cvalue, cdescription;
// Alles l?schen
public void clear() {
this.setCID(0);
this.setCkey("");
this.setCvalue("");
this.setCdescription("");
}
// Setter
public void setCID(Integer CID) {
this.CID = CID;
}
public void setCkey(String ckey) {
this.ckey = ckey;
}
public void setCvalue(String cvalue) {
this.cvalue = cvalue;
}
public void setCdescription(String cdescription) {
this.cdescription = cdescription;
}
// Getter
public Integer getCID() {
return this.CID;
}
public String getCkey() {
return this.ckey;
}
public String getCvalue() {
return this.cvalue;
}
public String getCdescription() {
return this.cdescription;
}
}
and i call it here
public class JConfig {
// public Collection c = new LinkedList();
// public Collection c = new ArrayList();
// public Collection c = new LinkedList();
// public Collection c = new HashSet();
// public HashMap c = new HashMap ();
// public HashMap c = new LinkedHashMap ();
// public ArrayList data = new ArrayList();
// public static ArrayList<HashMap<String, String>> data = new
ArrayList<HashMap<String, String>>();
public static HashMap<String, HashMap> data = new
LinkedHashMap<String, HashMap>();
public void JConfig() {
String strSQL = "";
JDb db = new JDb();
db.ConnectDb();
strSQL = "SELECT " +
" CID, " +
" ckey," +
" cvalue," +
" cdescription " +
"FROM " +
" config " +
"ORDER BY " +
" ckey";
db.makeQuery(strSQL);
try {
while (db.rs.next()) {
JConfigEntry c = new JConfigEntry();
c.setCID(db.rs.getInt("CID"));
c.setCkey(db.rs.getString("ckey"));
c.setCvalue(db.rs.getString("cvalue"));
c.setCdescription(db.rs.getString("cdescription"));
data.put("sys", c);
}
} catch (SQLException e) {
System.out.println("SQL Exception: " + e.toString());
}
// Einzelwert
HashMap item = (HashMap) data.get(0);
System.out.println("Einzelwerttest: " +item.get(""));
// ALle Werte ausgeben
for (HashMap<String, HashMap> c : data) {
for (String key : c.keySet()) {
System.out.println(key + ": " + c.get(key));
}
}
}
}
i get alwys this error: cannot find symbol at this line
data.put("sys", c);
Whats wrong ?