@Override public MetaClass getType() { return lhs.getType(); } }
@Override public MetaClass getType() { return lhs.getType(); } }
@Override public MetaClass getType() { return stmt.getType(); } };
@Override public MetaClass getType() { return stmt.getType(); } };
@Override public void handleCall(CallWriter writer, Context context, Statement statement) { resultType = statement.getType(); writer.prepend("return "); }
@Override public void handleCall(CallWriter writer, Context context, Statement statement) { resultType = statement.getType(); writer.prepend("return "); }
@Override public String generate(final Context context) { final String conditionString = condition.generate(context); final String trueString = trueStatement.generate(context); final String falseString = falseStatement.generate(context); returnType = trueStatement.getType(); if (falseStatement.getType().isAssignableFrom(returnType)) { returnType = falseStatement.getType(); } return conditionString.concat(" ? ").concat(trueString).concat(" : ").concat(falseString); }
@Override public String generate(final Context context) { final String conditionString = condition.generate(context); final String trueString = trueStatement.generate(context); final String falseString = falseStatement.generate(context); returnType = trueStatement.getType(); if (falseStatement.getType().isAssignableFrom(returnType)) { returnType = falseStatement.getType(); } return conditionString.concat(" ? ").concat(trueString).concat(" : ").concat(falseString); }
public MetaClass[] getParameterTypes() { final MetaClass[] parameterTypes = new MetaClass[parameters.size()]; for (int i = 0; i < parameters.size(); i++) { if (parameters.get(i) instanceof NullLiteral) { parameterTypes[i] = MetaClassFactory.get(NullType.class); } else if ((parameterTypes[i] = parameters.get(i).getType()) == null) { parameterTypes[i] = MetaClassFactory.get(Object.class); } } return parameterTypes; }
public boolean needsEncoding(String paramName) { // PathSegments are encoded in PathSegmentImpl if ((MetaClassFactory.get(PathSegment.class).equals(getParameterByName(PathParam.class, paramName).getType()))) { return false; } return true; }
private MetaClass inferType(final Context context, final Object initialization) { final Statement initStatement = GenUtil.generate(context, initialization); final MetaClass inferredType = (initStatement != null) ? initStatement.getType() : null; if (inferredType == null) { throw new InvalidTypeException("No type specified and no initialization provided to infer the type."); } return inferredType; }
private void checkSwitchExprType() { final boolean validType = supportedTypes.stream() .anyMatch(cls -> MetaClassFactory.get(cls).isAssignableFrom(switchExprStmt.getType().asBoxed())); if (!validType) throw new InvalidTypeException("Type not permitted in switch statements:" + switchExprStmt.getType().getFullyQualifiedName()); } }
private void checkSwitchExprType() { final boolean validType = supportedTypes.stream() .anyMatch(cls -> MetaClassFactory.get(cls).isAssignableFrom(switchExprStmt.getType().asBoxed())); if (!validType) throw new InvalidTypeException("Type not permitted in switch statements:" + switchExprStmt.getType().getFullyQualifiedName()); } }
private MetaClass inferType(final Context context, final Object initialization) { final Statement initStatement = GenUtil.generate(context, initialization); final MetaClass inferredType = (initStatement != null) ? initStatement.getType() : null; if (inferredType == null) { throw new InvalidTypeException("No type specified and no initialization provided to infer the type."); } return inferredType; }
private void implementInitProxyProperties(final ClassStructureBuilder<?> proxyImpl, final Injectable injectable) { final BlockBuilder<?> initBody = proxyImpl .publicMethod(void.class, "initProxyProperties", finalOf(injectable.getInjectedType(), "instance")).body(); for (final Entry<String, Statement> prop : controller.getProxyProperties()) { proxyImpl.privateField(prop.getKey(), prop.getValue().getType()).finish(); initBody.append(loadVariable(prop.getKey()).assignValue(prop.getValue())); } initBody.finish(); }
public static Statement marshal(final Statement statement, final String contentType) { if (statement instanceof Parameter) { final Parameter param = (Parameter) statement; return marshal(param.getType(), Variable.get(param.getName()), contentType); } return marshal(statement.getType(), statement, contentType); }
private static Statement supplierOf(final Statement value) { return newInstanceOf(parameterizedAs(Supplier.class, typeParametersOf(value.getType()))) .extend() .publicOverridesMethod("get") .append(Stmt.nestedCall(value).returnValue()) .finish() .finish(); }
private static Statement supplierOf(final Statement value) { return newInstanceOf(parameterizedAs(Supplier.class, typeParametersOf(value.getType()))) .extend() .publicOverridesMethod("get") .append(Stmt.nestedCall(value).returnValue()) .finish() .finish(); }