Hello,
I am using this code... Why does method isInsert always return false???
It returns false if type variable is equal to "insert" too...
thanx, miso
Code:
package org.hlavki.diplo.data;
import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/** @author Hibernate CodeGenerator */
public class ProblemContent implements Serializable {
/** identifier field */
private long id;
/** persistent field */
private String type;
/** persistent field */
private String content;
/** persistent field */
private boolean hidden;
/** persistent field */
private int order;
/** persistent field */
private org.hlavki.diplo.data.Problem problem;
/** full constructor */
public ProblemContent(String type, String content, boolean hidden, int order, org.hlavki.diplo.data.Problem problem) {
this.type = type;
this.content = content;
this.hidden = hidden;
this.order = order;
this.problem = problem;
}
/** default constructor */
public ProblemContent() {
}
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
public String getContent() {
return this.content;
}
public void setContent(String content) {
this.content = content;
}
public boolean isHidden() {
return this.hidden;
}
public void setHidden(boolean hidden) {
this.hidden = hidden;
}
public int getOrder() {
return this.order;
}
public void setOrder(int order) {
this.order = order;
}
public org.hlavki.diplo.data.Problem getProblem() {
return this.problem;
}
public void setProblem(org.hlavki.diplo.data.Problem problem) {
this.problem = problem;
}
public String toString() {
return new ToStringBuilder(this)
.append("id", getId())
.toString();
}
public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( !(other instanceof ProblemContent) ) return false;
ProblemContent castOther = (ProblemContent) other;
return new EqualsBuilder()
.append(this.getId(), castOther.getId())
.isEquals();
}
public int hashCode() {
return new HashCodeBuilder()
.append(getId())
.toHashCode();
}
public boolean isInsert() {
return (type == "insert");
}
}