Show JavaProperty.java syntax highlighted
package ca.ucalgary.cpsc.ebe.fitClipse.FixtureGenerater;
public class JavaProperty extends JavaClassChild {
private String type = "String";
private String value = null;
public JavaProperty(String name){
this.name = name;
}
public JavaProperty(String name, String access){
this.name = name;
this.access = access;
}
public JavaProperty(String name, String access, String value){
this.name = name;
this.access = access;
this.value = value;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public void setType(String type){
this.type = type;
}
public String getType(){
return this.type;
}
public String getIdentifier(){
return this.name;
}
private String renderValue(){
if(JavaSourceUtil.TYPE_CHAR.equals(this.type)){
return "'" + value + "'";
}
if(JavaSourceUtil.TYPE_STRING.equals(this.type)){
return "\"" + value + "\"";
}
return value;
}
public String render() {
StringBuffer propertySource = new StringBuffer();
propertySource.append(this.access).append(this.renderStaticAbstractIndicators()).append(" ").append(this.type);
propertySource.append(" ").append(this.name);
if(this.value != null){
propertySource.append(" = ").append(this.renderValue());
}
propertySource.append(";\n");
return propertySource.toString();
}
}
See more files for this project here