示例#1
0
  protected final boolean isZero(final JakExpression expr) {
    if (expr.hasConstantValue(this.context)) {
      Object object = expr.constantValue(this.context);

      if (object instanceof Boolean) {
        Boolean booleanValue = (Boolean) object;
        return booleanValue.equals(Boolean.FALSE);
      } else if (object instanceof Number) {
        Number numberValue = (Number) object;
        return (numberValue.intValue() == 0);
      } else {
        return false;
      }
    }
    return false;
  }
示例#2
0
 protected final boolean isInt(final JakExpression expr) {
   Type type = expr.type(this.context);
   return type.equals(boolean.class)
       || type.equals(byte.class)
       || type.equals(char.class)
       || type.equals(short.class)
       || type.equals(int.class);
 }
示例#3
0
 protected final boolean isNull(final JakExpression expr) {
   return expr.hasConstantValue(this.context) && (expr.constantValue(this.context) == null);
 }
示例#4
0
 protected final boolean isLong(final JakExpression expr) {
   return expr.type(this.context).equals(long.class);
 }
示例#5
0
 protected final boolean isRef(final JakExpression expr) {
   Type type = expr.type(this.context);
   return JavaTypes.getRawClass(type).isAssignableFrom(Object.class);
 }