
org.duelengine.duel.codedom.CodeObjectCreateExpression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of duel-compiler Show documentation
Show all versions of duel-compiler Show documentation
Dual-side template engine for the JVM
package org.duelengine.duel.codedom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Represents a constructor call
*/
public class CodeObjectCreateExpression extends CodeExpression {
private String typeName;
private final List arguments = new ArrayList();
public CodeObjectCreateExpression() {
}
public CodeObjectCreateExpression(String typeName, CodeExpression... args) {
this.typeName = typeName;
if (args != null) {
this.arguments.addAll(Arrays.asList(args));
}
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String value) {
typeName = value;
}
public List getArguments() {
return arguments;
}
@Override
public Class> getResultType() {
return Object.class;
}
@Override
public void visit(CodeVisitor visitor) {
if (visitor.visit(this)) {
for (CodeExpression expression : arguments) {
if (expression != null) {
expression.visit(visitor);
}
}
}
}
@Override
public boolean equals(Object arg) {
if (!(arg instanceof CodeObjectCreateExpression)) {
// includes null
return false;
}
CodeObjectCreateExpression that = (CodeObjectCreateExpression)arg;
if (this.typeName == null ? that.typeName != null : !this.typeName.equals(that.typeName)) {
return false;
}
int length = this.arguments.size();
if (length != that.arguments.size()) {
return false;
}
for (int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy