if (!method.isReturnTypeVoid())
if (!method.isReturnTypeVoid())
.addMethod().setPublic().setName(method.getName()); StringBuilder sb = new StringBuilder(); if (method.isReturnTypeVoid())
.addMethod().setPublic().setName(method.getName()); StringBuilder sb = new StringBuilder(); if (method.isReturnTypeVoid())
/** * Adds a default method implementation to the given {@link MethodSource}. This method will call * {@link MethodSource#setAbstract(false)} before setting the body if the origin is not an interface * * @param source */ public static void implementMethod(MethodSource<?> source) { if (source.getOrigin().isInterface()) { source.setBody(null); } else { if (source.isNative()) { source.setNative(false); } source.setAbstract(false); if (source.isReturnTypeVoid()) { source.setBody(""); } else { source.setBody("return " + Types.getDefaultValue(source.getReturnType().getName()) + ";"); } } }
/** * Adds a default method implementation to the given {@link MethodSource}. This method will call * {@link MethodSource#setAbstract(false)} before setting the body if the origin is not an interface * * @param source */ public static void implementMethod(MethodSource<?> source) { if (source.getOrigin().isInterface()) { source.setBody(null); } else { if (source.isNative()) { source.setNative(false); } source.setAbstract(false); if (source.isReturnTypeVoid()) { source.setBody(""); } else { source.setBody("return " + Types.getDefaultValue(source.getReturnType().getName()) + ";"); } } }