use of com.robotoworks.mechanoid.net.netModel.NumericLiteral in project mechanoid by robotoworks.
the class NetModelJavaValidator method checkValueAssignment.
@Check
public void checkValueAssignment(SimpleMemberAssignment assignment) {
IntrinsicType type = assignment.getMember().getType();
Literal defaultValue = assignment.getDefaultValue();
if (defaultValue == null) {
return;
}
if (type instanceof StringType) {
if (!(defaultValue instanceof StringLiteral)) {
error("Type mismatch", NetModelPackage.Literals.SIMPLE_MEMBER_ASSIGNMENT__DEFAULT_VALUE);
}
} else if (type instanceof BooleanType) {
if (!(defaultValue instanceof BooleanLiteral)) {
error("Type mismatch", NetModelPackage.Literals.SIMPLE_MEMBER_ASSIGNMENT__DEFAULT_VALUE);
}
// TODO Check each numeric type (double, integer, long, etc)
} else if (type instanceof NumericType) {
if (!(defaultValue instanceof NumericLiteral)) {
error("Type mismatch", NetModelPackage.Literals.SIMPLE_MEMBER_ASSIGNMENT__DEFAULT_VALUE);
}
}
}
Aggregations