private Variable(final String name, final MetaClass type, final Object initialization) { this(name, type); final LiteralValue<?> val = LiteralFactory.isLiteral(initialization); if (val != null) { this.type = (type == null) ? val.getType() : type; this.value = GenUtil.convert(Context.create(), initialization, this.type); } else { // deferred initialization this.initialization = initialization; } }
@Override public String generate(final Context context) { if (operator == null) { lhs = GenUtil.generate(context, lhs); lhs = GenUtil.convert(context, lhs, MetaClassFactory.get(Boolean.class)); } if (negated) { return UnaryOperator.Complement.getCanonicalString().concat("(") + super.generate(context).concat(")"); } return super.generate(context); }
private Variable(final String name, final MetaClass type, final Object initialization) { this(name, type); final LiteralValue<?> val = LiteralFactory.isLiteral(initialization); if (val != null) { this.type = (type == null) ? val.getType() : type; this.value = GenUtil.convert(Context.create(), initialization, this.type); } else { // deferred initialization this.initialization = initialization; } }
@Override public String generate(final Context context) { if (operator == null) { lhs = GenUtil.generate(context, lhs); lhs = GenUtil.convert(context, lhs, MetaClassFactory.get(Boolean.class)); } if (negated) { return UnaryOperator.Complement.getCanonicalString().concat("(") + super.generate(context).concat(")"); } return super.generate(context); }
@Override public String generate(final Context context) { if (operator == null) { lhs = GenUtil.generate(context, lhs); lhs = GenUtil.convert(context, lhs, MetaClassFactory.get(Boolean.class)); } return super.generate(context); }
@Override public String generate(final Context context) { if (operator == null) { lhs = GenUtil.generate(context, lhs); lhs = GenUtil.convert(context, lhs, MetaClassFactory.get(Boolean.class)); } return super.generate(context); }
@Override public String generate(final Context context) { if (generatedCache != null) return generatedCache; if (initialization != null) { this.type = (type == null) ? inferType(context, initialization) : type; this.value = GenUtil.convert(context, initialization, type); } return generatedCache = new DeclareAssignmentBuilder(isFinal, getReference(), value).generate(context); } }
@Override public String generate(final Context context) { if (generatedCache != null) return generatedCache; if (initialization != null) { this.type = (type == null) ? inferType(context, initialization) : type; this.value = GenUtil.convert(context, initialization, type); } return generatedCache = new DeclareAssignmentBuilder(isFinal, getReference(), value).generate(context); } }
public static Statement[] generateCallParameters(final MetaMethod method, final Context context, final Object... parameters) { if (parameters.length != method.getParameters().length && !method.isVarArgs()) { throw new UndefinedMethodException("Wrong number of parameters"); } final MetaParameter[] methParms = method.getParameters(); final Statement[] statements = new Statement[parameters.length]; int i = 0; for (Object parameter : parameters) { if (parameter instanceof Statement) { if (((Statement) parameter).getType() == null) { parameter = generate(context, parameter); } } try { statements[i] = convert(context, parameter, methParms[i++].getType()); } catch (final GenerationException t) { t.appendFailureInfo("in method call: " + method.getDeclaringClass().getFullyQualifiedName() + "." + method.getName() + "(" + Arrays.toString(methParms) + ")"); throw t; } } return statements; }
public static Statement[] generateCallParameters(final MetaMethod method, final Context context, final Object... parameters) { if (parameters.length != method.getParameters().length && !method.isVarArgs()) { throw new UndefinedMethodException("Wrong number of parameters"); } final MetaParameter[] methParms = method.getParameters(); final Statement[] statements = new Statement[parameters.length]; int i = 0; for (Object parameter : parameters) { if (parameter instanceof Statement) { if (((Statement) parameter).getType() == null) { parameter = generate(context, parameter); } } try { statements[i] = convert(context, parameter, methParms[i++].getType()); } catch (final GenerationException t) { t.appendFailureInfo("in method call: " + method.getDeclaringClass().getFullyQualifiedName() + "." + method.getName() + "(" + Arrays.toString(methParms) + ")"); throw t; } } return statements; }
final Statement[] idx = new Statement[this.indexes.length]; for (int i = 0; i < idx.length; i++) { idx[i] = GenUtil.convert(context, GenUtil.generate(context, this.indexes[i]), MetaClassFactory.get(Integer.class));
final Statement[] idx = new Statement[this.indexes.length]; for (int i = 0; i < idx.length; i++) { idx[i] = GenUtil.convert(context, GenUtil.generate(context, this.indexes[i]), MetaClassFactory.get(Integer.class));