proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/threeD/Camera.java | Camera | getContext | class Camera extends Component {
private final Center center;
private final Up up;
private final Eye eye;
private Camera(CameraBuilder builder) {
this.eye = builder.eye;
this.up = builder.up;
this.center = builder.center;
}
@Override
protected Map<String, Object> getContext() {<FILL_FUNCTIO... |
Map<String, Object> context = new HashMap<>();
context.put("up", up);
context.put("eye", eye);
context.put("center", center);
return context;
| 299 | 54 | 353 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/threeD/CameraComponent.java | CameraComponent | getContext | class CameraComponent extends Component {
private final double x;
private final double y;
private final double z;
CameraComponent(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
@Override
public String asJavascript() {
return asJSON();
}
@Override
protected ... |
Map<String, Object> context = new HashMap<>();
context.put("x", x);
context.put("y", y);
context.put("z", z);
return context;
| 156 | 53 | 209 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/threeD/Scene.java | Scene | asJavascript | class Scene extends Component {
private final Axis xAxis;
private final Axis yAxis;
private final Axis zAxis;
private final Camera camera;
private Scene(SceneBuilder builder) {
this.xAxis = builder.xAxis;
this.yAxis = builder.yAxis;
this.zAxis = builder.zAxis;
this.camera = builder.camera... |
Writer writer = new StringWriter();
PebbleTemplate compiledTemplate;
try {
compiledTemplate = getEngine().getTemplate("scene_template.html");
compiledTemplate.evaluate(writer, getContext());
} catch (PebbleException e) {
throw new IllegalStateException(e);
} catch (IOException e) ... | 499 | 109 | 608 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/display/Browser.java | Browser | browse | class Browser {
public static void main(String[] args) throws Exception {
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().browse(new URI("http://www.example.com"));
}
}
public void browse(File file) throws IOException {<FILL_FUNCTION_BODY>}
} |
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().browse(file.toURI());
} else {
throw new UnsupportedOperationException("Browser not supported.");
}
| 87 | 52 | 139 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/event/HoverBroadcastBody.java | HoverBroadcastBody | asJavascript | class HoverBroadcastBody implements EventHandlerBody {
private final String[] subPlots;
private final int nTraces;
public static HoverBroadcastBuilder builder() {
return new HoverBroadcastBuilder();
}
private HoverBroadcastBody(HoverBroadcastBuilder builder) {
this.subPlots = builder.subPlots;
... |
StringBuilder builder = new StringBuilder();
builder.append(String.format("\tvar pointIndex = %s.points[0].pointNumber;", eventData));
builder.append(System.lineSeparator());
builder.append(String.format("\tPlotly.Fx.hover('%s',[ ", divName));
builder.append(System.lineSeparator());
for (int ... | 296 | 342 | 638 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/event/HoverEventHandler.java | HoverEventHandler | asJavascript | class HoverEventHandler implements EventHandler {
private final EventHandlerBody body;
private final String eventDataVarName = "eventData";
public static HoverEventHanlderBuilder builder() {
return new HoverEventHanlderBuilder();
}
private HoverEventHandler(HoverEventHanlderBuilder builder) {
this.... |
StringBuilder builder = new StringBuilder();
builder.append(
String.format("%s.on('plotly_hover', function(%s){", targetName, eventDataVarName));
builder.append(System.lineSeparator());
builder.append(body.asJavascript(targetName, divName, eventDataVarName));
builder.append("});");
b... | 287 | 115 | 402 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/traces/AbstractTrace.java | AbstractTrace | getContext | class AbstractTrace implements Trace {
protected static final double DEFAULT_OPACITY = 1.0;
protected static final Visibility DEFAULT_VISIBILITY = Visibility.TRUE;
protected final PebbleEngine engine = TemplateUtils.getNewEngine();
public enum Visibility {
TRUE("True"),
FALSE("False"),
LEGEND_ONL... |
Map<String, Object> context = new HashMap<>();
context.put("type", type);
context.put("name", name);
if (showLegend != null) {
context.put("showLegend", showLegend);
}
context.put("legendGroup", legendGroup);
if (!visible.equals(DEFAULT_VISIBILITY)) {
context.put("visible", vi... | 885 | 194 | 1,079 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/traces/BarTrace.java | BarTrace | asJavascript | class BarTrace extends AbstractTrace {
private final Object[] x;
private final double[] y;
private final Orientation orientation;
private final Marker marker;
private BarTrace(BarBuilder builder) {
super(builder);
this.orientation = builder.orientation;
this.x = builder.x;
this.y = builder.y... |
Writer writer = new StringWriter();
PebbleTemplate compiledTemplate;
try {
compiledTemplate = engine.getTemplate("trace_template.html");
compiledTemplate.evaluate(writer, getContext(i));
} catch (PebbleException e) {
throw new IllegalStateException(e);
} catch (IOException e) {
... | 946 | 110 | 1,056 | <methods>public void <init>(tech.tablesaw.plotly.traces.TraceBuilder) ,public tech.tablesaw.plotly.components.HoverLabel hoverLabel() ,public java.lang.String name() ,public boolean showLegend() ,public java.lang.String toString() <variables>protected static final double DEFAULT_OPACITY,protected static final tech.tabl... |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/traces/BoxTrace.java | BoxTrace | builder | class BoxTrace extends AbstractTrace {
private final Object[] x;
private final double[] y;
private BoxTrace(BoxBuilder builder) {
super(builder);
this.x = builder.x;
this.y = builder.y;
}
public static BoxBuilder builder(Object[] x, double[] y) {
return new BoxBuilder(x, y);
}
public s... |
Double[] xObjs = new Double[x.length];
for (int i = 0; i < x.length; i++) {
xObjs[i] = x[i];
}
return new BoxBuilder(xObjs, y);
| 664 | 66 | 730 | <methods>public void <init>(tech.tablesaw.plotly.traces.TraceBuilder) ,public tech.tablesaw.plotly.components.HoverLabel hoverLabel() ,public java.lang.String name() ,public boolean showLegend() ,public java.lang.String toString() <variables>protected static final double DEFAULT_OPACITY,protected static final tech.tabl... |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/traces/ContourTrace.java | ContourTrace | getContext | class ContourTrace extends AbstractTrace {
private final Object[] x;
private final Object[] y;
private final double[][] z;
private final String type;
public ContourTrace(ContourBuilder builder) {
super(builder);
this.x = builder.x;
this.y = builder.y;
this.z = builder.z;
this.type = buil... |
Map<String, Object> context = super.getContext();
context.put("variableName", "trace0");
context.put("x", dataAsString(x));
context.put("y", dataAsString(y));
context.put("z", dataAsString(z));
context.put("type", type);
return context;
| 542 | 89 | 631 | <methods>public void <init>(tech.tablesaw.plotly.traces.TraceBuilder) ,public tech.tablesaw.plotly.components.HoverLabel hoverLabel() ,public java.lang.String name() ,public boolean showLegend() ,public java.lang.String toString() <variables>protected static final double DEFAULT_OPACITY,protected static final tech.tabl... |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/traces/HeatmapTrace.java | HeatmapTrace | getContext | class HeatmapTrace extends AbstractTrace {
private final Object[] x;
private final Object[] y;
private final double[][] z;
private final String type;
private HeatmapTrace(HeatmapBuilder builder) {
super(builder);
this.x = builder.x;
this.y = builder.y;
this.z = builder.z;
this.type = bui... |
Map<String, Object> context = super.getContext();
context.put("variableName", "trace0");
context.put("x", dataAsString(x));
context.put("y", dataAsString(y));
context.put("z", dataAsString(z));
context.put("type", type);
return context;
| 527 | 89 | 616 | <methods>public void <init>(tech.tablesaw.plotly.traces.TraceBuilder) ,public tech.tablesaw.plotly.components.HoverLabel hoverLabel() ,public java.lang.String name() ,public boolean showLegend() ,public java.lang.String toString() <variables>protected static final double DEFAULT_OPACITY,protected static final tech.tabl... |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/traces/Histogram2DTrace.java | Histogram2DTrace | getContext | class Histogram2DTrace extends AbstractTrace {
private final double[] x;
private final double[] y;
public static Histogram2DBuilder builder(double[] x, double[] y) {
return new Histogram2DBuilder(x, y);
}
public static Histogram2DBuilder builder(
NumericColumn<? extends Number> x, NumericColumn<?... |
Map<String, Object> context = super.getContext();
context.put("variableName", "trace" + i);
context.put("x", Utils.dataAsString(x));
context.put("y", Utils.dataAsString(y));
return context;
| 646 | 73 | 719 | <methods>public void <init>(tech.tablesaw.plotly.traces.TraceBuilder) ,public tech.tablesaw.plotly.components.HoverLabel hoverLabel() ,public java.lang.String name() ,public boolean showLegend() ,public java.lang.String toString() <variables>protected static final double DEFAULT_OPACITY,protected static final tech.tabl... |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/traces/HistogramTrace.java | HistogramBuilder | doublesToObjects | class HistogramBuilder extends TraceBuilder {
private final String type = "histogram";
private int nBinsX;
private int nBinsY;
private boolean autoBinX;
private boolean autoBinY;
private boolean horizontal = false;
private Object[] x;
private Object[] y;
private Marker marker;
p... |
Object[] objects = new Object[doubles.length];
for (int i = 0; i < doubles.length; i++) {
objects[i] = doubles[i];
}
return objects;
| 1,292 | 58 | 1,350 | <methods>public void <init>(tech.tablesaw.plotly.traces.TraceBuilder) ,public tech.tablesaw.plotly.components.HoverLabel hoverLabel() ,public java.lang.String name() ,public boolean showLegend() ,public java.lang.String toString() <variables>protected static final double DEFAULT_OPACITY,protected static final tech.tabl... |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/traces/PieTrace.java | PieTrace | asJavascript | class PieTrace extends AbstractTrace {
private final double[] values;
private final Object[] labels;
private final Domain domain;
private PieTrace(PieBuilder builder) {
super(builder);
this.values = builder.values;
this.labels = builder.labels;
this.domain = builder.domain;
}
@Override
... |
Writer writer = new StringWriter();
PebbleTemplate compiledTemplate;
try {
compiledTemplate = engine.getTemplate("pie_trace_template.html");
compiledTemplate.evaluate(writer, getContext(i));
} catch (PebbleException e) {
throw new IllegalStateException(e);
} catch (IOException e)... | 539 | 112 | 651 | <methods>public void <init>(tech.tablesaw.plotly.traces.TraceBuilder) ,public tech.tablesaw.plotly.components.HoverLabel hoverLabel() ,public java.lang.String name() ,public boolean showLegend() ,public java.lang.String toString() <variables>protected static final double DEFAULT_OPACITY,protected static final tech.tabl... |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/traces/Scatter3DTrace.java | Scatter3DTrace | asJavascript | class Scatter3DTrace extends AbstractTrace {
private final double[] y;
private final double[] x;
private final double[] z;
private final String[] text;
private final Mode mode;
private final HoverLabel hoverLabel;
private final Marker marker;
public static Scatter3DBuilder builder(double[] x, double[]... |
Writer writer = new StringWriter();
PebbleTemplate compiledTemplate;
try {
compiledTemplate = engine.getTemplate("trace_template.html");
Map<String, Object> context = getContext(i);
compiledTemplate.evaluate(writer, context);
} catch (PebbleException e) {
throw new IllegalState... | 1,315 | 122 | 1,437 | <methods>public void <init>(tech.tablesaw.plotly.traces.TraceBuilder) ,public tech.tablesaw.plotly.components.HoverLabel hoverLabel() ,public java.lang.String name() ,public boolean showLegend() ,public java.lang.String toString() <variables>protected static final double DEFAULT_OPACITY,protected static final tech.tabl... |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/traces/TraceBuilder.java | TraceBuilder | columnToStringArray | class TraceBuilder {
protected AbstractTrace.Visibility visible = AbstractTrace.DEFAULT_VISIBILITY;
/** Determines whether or not an item corresponding to this trace is shown in the legend. */
protected Boolean showLegend = null;
/**
* Sets the legend group for this trace. Traces part of the same legend g... |
String[] x = new String[column.size()];
for (int i = 0; i < column.size(); i++) {
x[i] = column.getString(i);
}
return x;
| 800 | 57 | 857 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/traces/ViolinTrace.java | ViolinTrace | asJavascript | class ViolinTrace extends AbstractTrace {
private final Object[] x;
private final double[] y;
private final boolean showBoxPlot;
private final boolean showMeanLine;
private ViolinTrace(ViolinBuilder builder) {
super(builder);
this.x = builder.x;
this.y = builder.y;
... |
Writer writer = new StringWriter();
PebbleTemplate compiledTemplate;
try {
compiledTemplate = engine.getTemplate("trace_template.html");
compiledTemplate.evaluate(writer, getContext(i));
} catch (PebbleException e) {
throw new IllegalStateException(e... | 850 | 110 | 960 | <methods>public void <init>(tech.tablesaw.plotly.traces.TraceBuilder) ,public tech.tablesaw.plotly.components.HoverLabel hoverLabel() ,public java.lang.String name() ,public boolean showLegend() ,public java.lang.String toString() <variables>protected static final double DEFAULT_OPACITY,protected static final tech.tabl... |
jtablesaw_tablesaw | tablesaw/saw/src/main/java/tech/tablesaw/io/saw/ColumnMetadata.java | ColumnMetadata | equals | class ColumnMetadata {
private String id;
private String name;
private String type;
// number of unique values in column - not all columns will provide this as it can be expensive
private int cardinality;
// these attributes are specific to string columns
private String stringColumnKeySize;
private i... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ColumnMetadata that = (ColumnMetadata) o;
return Objects.equal(getId(), that.getId())
&& Objects.equal(getName(), that.getName())
&& Objects.equal(getType(), that.getType())
&& Objects.equal(g... | 1,016 | 111 | 1,127 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/saw/src/main/java/tech/tablesaw/io/saw/SawMetadata.java | SawMetadata | toJson | class SawMetadata {
// The name of the file that this data is written to
static final String METADATA_FILE_NAME = "Metadata.json";
// The version of the Saw Storage system used to write the file
private static final int SAW_VERSION = 3;
private static final ObjectMapper objectMapper = new ObjectMapper();
... |
try {
return objectMapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
throw new UncheckedIOException(e);
}
| 1,003 | 46 | 1,049 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/saw/src/main/java/tech/tablesaw/io/saw/SawUtils.java | SawUtils | makeName | class SawUtils {
private static final Pattern WHITE_SPACE_PATTERN = Pattern.compile("\\s+");
private static final String FILE_EXTENSION = "saw";
private static final Pattern SEPARATOR_PATTERN =
Pattern.compile(Pattern.quote(FileSystems.getDefault().getSeparator()));
private SawUtils() {}
static final... |
// remove whitespace from table name
String nm = WHITE_SPACE_PATTERN.matcher(name).replaceAll("");
nm = SEPARATOR_PATTERN.matcher(nm).replaceAll("_"); // remove path separators from name
return nm + '.' + FILE_EXTENSION;
| 291 | 79 | 370 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/saw/src/main/java/tech/tablesaw/io/saw/TableMetadata.java | TableMetadata | equals | class TableMetadata {
@JsonProperty("columnMetadata")
private final List<ColumnMetadata> columnMetadataList = new ArrayList<>();
// The name of the table
private String name;
// The number of rows in the table
private int rowCount;
@JsonIgnore private Map<String, ColumnMetadata> columnMetadataMap = ne... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TableMetadata metadata = (TableMetadata) o;
return getRowCount() == metadata.getRowCount()
&& Objects.equal(getColumnMetadataList(), metadata.getColumnMetadataList())
&& Objects.equal(getName(), metad... | 781 | 95 | 876 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-jakarta/src/main/java/org/thymeleaf/examples/core/gtvg/jakarta/business/entities/repositories/OrderRepository.java | OrderRepository | findByCustomerId | class OrderRepository {
private static final OrderRepository INSTANCE = new OrderRepository();
private final Map<Integer,Order> ordersById;
private final Map<Integer,List<Order>> ordersByCustomerId;
public static OrderRepository getInstance() {
return INSTANCE;
}
... |
final List<Order> ordersForCustomerId = this.ordersByCustomerId.get(customerId);
if (ordersForCustomerId == null) {
return new ArrayList<Order>();
}
return ordersForCustomerId;
| 1,331 | 59 | 1,390 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-jakarta/src/main/java/org/thymeleaf/examples/core/gtvg/jakarta/business/util/CalendarUtil.java | CalendarUtil | calendarFor | class CalendarUtil {
public static Calendar calendarFor(
final int year, final int month, final int day, final int hour, final int minute) {<FILL_FUNCTION_BODY>}
private CalendarUtil() {
super();
}
} |
final Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.HOUR_OF_DAY, hour);
cal.set(Calendar.MINUTE, minute);
cal.set(Calendar.SECOND, 0);
... | 78 | 133 | 211 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-jakarta/src/main/java/org/thymeleaf/examples/core/gtvg/jakarta/web/controller/HomeController.java | HomeController | process | class HomeController implements IGTVGController {
public HomeController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
WebContext ctx = new WebContext(webExchange, webExchange.getLocale());
ctx.setVariable("today", Calendar.getInstance());
templateEngine.process("home", ctx, writer);
| 79 | 58 | 137 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-jakarta/src/main/java/org/thymeleaf/examples/core/gtvg/jakarta/web/controller/OrderDetailsController.java | OrderDetailsController | process | class OrderDetailsController implements IGTVGController {
public OrderDetailsController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
final Integer orderId = Integer.valueOf(webExchange.getRequest().getParameterValue("orderId"));
final OrderService orderService = new OrderService();
final Order order = orderService.findById(orderId);
final WebContext ctx = new WebContext(webExchange, webExch... | 81 | 115 | 196 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-jakarta/src/main/java/org/thymeleaf/examples/core/gtvg/jakarta/web/controller/OrderListController.java | OrderListController | process | class OrderListController implements IGTVGController {
public OrderListController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
final OrderService orderService = new OrderService();
final List<Order> allOrders = orderService.findAll();
final WebContext ctx = new WebContext(webExchange, webExchange.getLocale());
ctx.setVariable("orders", allOrders);
templateEngine.process("order... | 81 | 91 | 172 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-jakarta/src/main/java/org/thymeleaf/examples/core/gtvg/jakarta/web/controller/ProductCommentsController.java | ProductCommentsController | process | class ProductCommentsController implements IGTVGController {
public ProductCommentsController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
final Integer prodId = Integer.valueOf(webExchange.getRequest().getParameterValue("prodId"));
final ProductService productService = new ProductService();
final Product product = productService.findById(prodId);
final WebContext ctx = new WebContext(webExchange... | 83 | 115 | 198 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-jakarta/src/main/java/org/thymeleaf/examples/core/gtvg/jakarta/web/controller/ProductListController.java | ProductListController | process | class ProductListController implements IGTVGController {
public ProductListController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
final ProductService productService = new ProductService();
final List<Product> allProducts = productService.findAll();
final WebContext ctx = new WebContext(webExchange, webExchange.getLocale());
ctx.setVariable("prods", allProducts);
templateEngine.p... | 81 | 92 | 173 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-jakarta/src/main/java/org/thymeleaf/examples/core/gtvg/jakarta/web/controller/SubscribeController.java | SubscribeController | process | class SubscribeController implements IGTVGController {
public SubscribeController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
WebContext ctx = new WebContext(webExchange, webExchange.getLocale());
templateEngine.process("subscribe", ctx, writer);
| 81 | 42 | 123 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-jakarta/src/main/java/org/thymeleaf/examples/core/gtvg/jakarta/web/controller/UserProfileController.java | UserProfileController | process | class UserProfileController implements IGTVGController {
public UserProfileController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
final WebContext ctx = new WebContext(webExchange, webExchange.getLocale());
templateEngine.process("userprofile", ctx, writer);
| 81 | 44 | 125 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-jakarta/src/main/java/org/thymeleaf/examples/core/gtvg/jakarta/web/filter/GTVGFilter.java | GTVGFilter | process | class GTVGFilter implements Filter {
private ITemplateEngine templateEngine;
private JakartaServletWebApplication application;
public GTVGFilter() {
super();
}
private static void addUserToSession(final HttpServletRequest request) {
// Simulate a real user sessi... |
try {
final IWebExchange webExchange = this.application.buildExchange(request, response);
final IWebRequest webRequest = webExchange.getRequest();
// This prevents triggering engine executions for resource URLs
if (webRequest.getPathWithinApplication()... | 599 | 452 | 1,051 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-jakarta/src/main/java/org/thymeleaf/examples/core/gtvg/jakarta/web/mapping/ControllerMappings.java | ControllerMappings | getRequestPath | class ControllerMappings {
private static Map<String, IGTVGController> controllersByURL;
static {
controllersByURL = new HashMap<String, IGTVGController>();
controllersByURL.put("/", new HomeController());
controllersByURL.put("/product/list", new ProductListController());
co... |
String requestPath = request.getPathWithinApplication();
final int fragmentIndex = requestPath.indexOf(';');
if (fragmentIndex != -1) {
requestPath = requestPath.substring(0, fragmentIndex);
}
return requestPath;
| 300 | 72 | 372 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-javax/src/main/java/org/thymeleaf/examples/core/gtvg/javax/business/entities/repositories/OrderRepository.java | OrderRepository | findByCustomerId | class OrderRepository {
private static final OrderRepository INSTANCE = new OrderRepository();
private final Map<Integer,Order> ordersById;
private final Map<Integer,List<Order>> ordersByCustomerId;
public static OrderRepository getInstance() {
return INSTANCE;
}
... |
final List<Order> ordersForCustomerId = this.ordersByCustomerId.get(customerId);
if (ordersForCustomerId == null) {
return new ArrayList<Order>();
}
return ordersForCustomerId;
| 1,331 | 59 | 1,390 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-javax/src/main/java/org/thymeleaf/examples/core/gtvg/javax/business/util/CalendarUtil.java | CalendarUtil | calendarFor | class CalendarUtil {
public static Calendar calendarFor(
final int year, final int month, final int day, final int hour, final int minute) {<FILL_FUNCTION_BODY>}
private CalendarUtil() {
super();
}
} |
final Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.HOUR_OF_DAY, hour);
cal.set(Calendar.MINUTE, minute);
cal.set(Calendar.SECOND, 0);
... | 78 | 133 | 211 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-javax/src/main/java/org/thymeleaf/examples/core/gtvg/javax/web/controller/HomeController.java | HomeController | process | class HomeController implements IGTVGController {
public HomeController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
WebContext ctx = new WebContext(webExchange, webExchange.getLocale());
ctx.setVariable("today", Calendar.getInstance());
templateEngine.process("home", ctx, writer);
| 79 | 58 | 137 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-javax/src/main/java/org/thymeleaf/examples/core/gtvg/javax/web/controller/OrderDetailsController.java | OrderDetailsController | process | class OrderDetailsController implements IGTVGController {
public OrderDetailsController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
final Integer orderId = Integer.valueOf(webExchange.getRequest().getParameterValue("orderId"));
final OrderService orderService = new OrderService();
final Order order = orderService.findById(orderId);
final WebContext ctx = new WebContext(webExchange, webExch... | 81 | 115 | 196 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-javax/src/main/java/org/thymeleaf/examples/core/gtvg/javax/web/controller/OrderListController.java | OrderListController | process | class OrderListController implements IGTVGController {
public OrderListController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
final OrderService orderService = new OrderService();
final List<Order> allOrders = orderService.findAll();
final WebContext ctx = new WebContext(webExchange, webExchange.getLocale());
ctx.setVariable("orders", allOrders);
templateEngine.process("order... | 81 | 91 | 172 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-javax/src/main/java/org/thymeleaf/examples/core/gtvg/javax/web/controller/ProductCommentsController.java | ProductCommentsController | process | class ProductCommentsController implements IGTVGController {
public ProductCommentsController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
final Integer prodId = Integer.valueOf(webExchange.getRequest().getParameterValue("prodId"));
final ProductService productService = new ProductService();
final Product product = productService.findById(prodId);
final WebContext ctx = new WebContext(webExchange... | 83 | 115 | 198 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-javax/src/main/java/org/thymeleaf/examples/core/gtvg/javax/web/controller/ProductListController.java | ProductListController | process | class ProductListController implements IGTVGController {
public ProductListController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
final ProductService productService = new ProductService();
final List<Product> allProducts = productService.findAll();
final WebContext ctx = new WebContext(webExchange, webExchange.getLocale());
ctx.setVariable("prods", allProducts);
templateEngine.p... | 81 | 92 | 173 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-javax/src/main/java/org/thymeleaf/examples/core/gtvg/javax/web/controller/SubscribeController.java | SubscribeController | process | class SubscribeController implements IGTVGController {
public SubscribeController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
WebContext ctx = new WebContext(webExchange, webExchange.getLocale());
templateEngine.process("subscribe", ctx, writer);
| 81 | 42 | 123 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-javax/src/main/java/org/thymeleaf/examples/core/gtvg/javax/web/controller/UserProfileController.java | UserProfileController | process | class UserProfileController implements IGTVGController {
public UserProfileController() {
super();
}
public void process(final IWebExchange webExchange, final ITemplateEngine templateEngine, final Writer writer)
throws Exception {<FILL_FUNCTION_BODY>}
} |
final WebContext ctx = new WebContext(webExchange, webExchange.getLocale());
templateEngine.process("userprofile", ctx, writer);
| 81 | 44 | 125 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-javax/src/main/java/org/thymeleaf/examples/core/gtvg/javax/web/filter/GTVGFilter.java | GTVGFilter | process | class GTVGFilter implements Filter {
private ITemplateEngine templateEngine;
private JavaxServletWebApplication application;
public GTVGFilter() {
super();
}
private static void addUserToSession(final HttpServletRequest request) {
// Simulate a real user session... |
try {
final IWebExchange webExchange = this.application.buildExchange(request, response);
final IWebRequest webRequest = webExchange.getRequest();
// This prevents triggering engine executions for resource URLs
if (webRequest.getPathWithinApplication()... | 597 | 452 | 1,049 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/core/thymeleaf-examples-gtvg-javax/src/main/java/org/thymeleaf/examples/core/gtvg/javax/web/mapping/ControllerMappings.java | ControllerMappings | getRequestPath | class ControllerMappings {
private static Map<String, IGTVGController> controllersByURL;
static {
controllersByURL = new HashMap<String, IGTVGController>();
controllersByURL.put("/", new HomeController());
controllersByURL.put("/product/list", new ProductListController());
co... |
String requestPath = request.getPathWithinApplication();
final int fragmentIndex = requestPath.indexOf(';');
if (fragmentIndex != -1) {
requestPath = requestPath.substring(0, fragmentIndex);
}
return requestPath;
| 299 | 72 | 371 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-extrathyme/src/main/java/org/thymeleaf/examples/spring5/extrathyme/SpringWebApplicationInitializer.java | SpringWebApplicationInitializer | getServletFilters | class SpringWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
public static final String CHARACTER_ENCODING = "UTF-8";
public SpringWebApplicationInitializer() {
super();
}
@Override
protected Class<?>[] getServletConfigClasses() {
return ... |
final CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
encodingFilter.setEncoding(CHARACTER_ENCODING);
encodingFilter.setForceEncoding(true);
return new Filter[] { encodingFilter };
| 195 | 55 | 250 | <methods>public void <init>() <variables> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-extrathyme/src/main/java/org/thymeleaf/examples/spring5/extrathyme/business/entities/Headline.java | Headline | compareTo | class Headline
implements Comparable<Headline> {
private final Calendar date;
private final String text;
public Headline(final Calendar date, final String text) {
super();
this.date = date;
this.text = text;
}
public Calendar getDate() {
re... |
if (o == null) {
return 1;
}
return this.date.compareTo(o.date);
| 151 | 35 | 186 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-extrathyme/src/main/java/org/thymeleaf/examples/spring5/extrathyme/business/entities/repositories/HeadlineRepository.java | HeadlineRepository | findAllHeadlines | class HeadlineRepository {
public HeadlineRepository() {
super();
}
public List<Headline> findAllHeadlines() {<FILL_FUNCTION_BODY>}
} |
final List<Headline> headlines = new ArrayList<Headline>();
headlines.add(new Headline(Calendar.getInstance(), "Spearmint Caterpillars 1 - 0 Parsley Warriors"));
headlines.add(new Headline(Calendar.getInstance(), "Laurel Troglodytes 1 - 1 Rosemary 75ers"));
headlines.a... | 62 | 205 | 267 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-extrathyme/src/main/java/org/thymeleaf/examples/spring5/extrathyme/business/entities/repositories/TeamRepository.java | TeamRepository | findAllTeams | class TeamRepository {
public TeamRepository() {
super();
}
public List<Team> findAllTeams() {<FILL_FUNCTION_BODY>}
} |
final List<Team> teams = new ArrayList<Team>();
teams.add(new Team("SPC", "Spearmint Caterpillars", 73, 21, 10, 5));
teams.add(new Team("BAD", "Basil Dragons", 72, 21, 9, 6));
teams.add(new Team("SPS", "Sweet Paprika Savages", 57, 15, 12, 9));
teams.add(new Tea... | 59 | 380 | 439 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-extrathyme/src/main/java/org/thymeleaf/examples/spring5/extrathyme/business/util/RemarkUtil.java | RemarkUtil | getRemarkForPosition | class RemarkUtil {
public static Remark getRemarkForPosition(final Integer position) {<FILL_FUNCTION_BODY>}
private RemarkUtil() {
super();
}
} |
if (position == null) {
return null;
}
switch (position.intValue()) {
case 1: return Remark.WORLD_CHAMPIONS_LEAGUE;
case 2:
case 3: return Remark.CONTINENTAL_PLAYOFFS;
case 10: return Remark.RELEGATION;
}
retur... | 59 | 106 | 165 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-extrathyme/src/main/java/org/thymeleaf/examples/spring5/extrathyme/dialects/score/ClassForPositionAttributeTagProcessor.java | ClassForPositionAttributeTagProcessor | doProcess | class ClassForPositionAttributeTagProcessor extends AbstractAttributeTagProcessor {
private static final String ATTR_NAME = "classforposition";
private static final int PRECEDENCE = 10000;
public ClassForPositionAttributeTagProcessor(final String dialectPrefix) {
super(
TemplateMode.H... |
final IEngineConfiguration configuration = context.getConfiguration();
/*
* Obtain the Thymeleaf Standard Expression parser
*/
final IStandardExpressionParser parser =
StandardExpressions.getExpressionParser(configuration);
/*
* Parse the at... | 269 | 398 | 667 | <methods><variables>private final non-sealed boolean removeAttribute |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-extrathyme/src/main/java/org/thymeleaf/examples/spring5/extrathyme/dialects/score/HeadlinesElementTagProcessor.java | HeadlinesElementTagProcessor | doProcess | class HeadlinesElementTagProcessor extends AbstractElementTagProcessor {
private static final String TAG_NAME = "headlines";
private static final int PRECEDENCE = 1000;
private final Random rand = new Random(System.currentTimeMillis());
public HeadlinesElementTagProcessor(final String dialectPrefix... |
/*
* Obtain the Spring application context.
*/
final ApplicationContext appCtx = SpringContextUtils.getApplicationContext(context);
/*
* Obtain the HeadlineRepository bean from the application context, and ask
* it for the current list of headlines.
... | 264 | 518 | 782 | <methods>public void <init>(org.thymeleaf.templatemode.TemplateMode, java.lang.String, java.lang.String, boolean, java.lang.String, boolean, int) ,public final org.thymeleaf.processor.element.MatchingAttributeName getMatchingAttributeName() ,public final org.thymeleaf.processor.element.MatchingElementName getMatchingEl... |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-extrathyme/src/main/java/org/thymeleaf/examples/spring5/extrathyme/dialects/score/MatchDayTodayModelProcessor.java | MatchDayTodayModelProcessor | checkPositionInMarkup | class MatchDayTodayModelProcessor extends AbstractAttributeModelProcessor {
private static final String ATTR_NAME = "match-day-today";
private static final int PRECEDENCE = 100;
public MatchDayTodayModelProcessor(final String dialectPrefix) {
super(
TemplateMode.HTML, // This processo... |
/*
* We want to make sure this processor is being applied inside a container tag which has
* class="leaguetable". So we need to check the second-to-last entry in the element stack
* (the last entry is the tag being processed itself).
*/
final List<IProcessableEleme... | 569 | 193 | 762 | <methods><variables>private final non-sealed boolean removeAttribute |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-extrathyme/src/main/java/org/thymeleaf/examples/spring5/extrathyme/dialects/score/RemarkForPositionAttributeTagProcessor.java | RemarkForPositionAttributeTagProcessor | doProcess | class RemarkForPositionAttributeTagProcessor extends AbstractAttributeTagProcessor {
private static final String ATTR_NAME = "remarkforposition";
private static final int PRECEDENCE = 12000;
public RemarkForPositionAttributeTagProcessor(final String dialectPrefix) {
super(
TemplateMod... |
final IEngineConfiguration configuration = context.getConfiguration();
/*
* Obtain the Thymeleaf Standard Expression parser
*/
final IStandardExpressionParser parser =
StandardExpressions.getExpressionParser(configuration);
/*
* Parse the at... | 269 | 460 | 729 | <methods><variables>private final non-sealed boolean removeAttribute |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-extrathyme/src/main/java/org/thymeleaf/examples/spring5/extrathyme/dialects/score/ScoreDialect.java | ScoreDialect | getProcessors | class ScoreDialect extends AbstractProcessorDialect {
private static final String DIALECT_NAME = "Score Dialect";
public ScoreDialect() {
// We will set this dialect the same "dialect processor" precedence as
// the Standard Dialect, so that processor executions can interleave.
super(... |
final Set<IProcessor> processors = new HashSet<IProcessor>();
processors.add(new ClassForPositionAttributeTagProcessor(dialectPrefix));
processors.add(new RemarkForPositionAttributeTagProcessor(dialectPrefix));
processors.add(new HeadlinesElementTagProcessor(dialectPrefix));
pro... | 192 | 147 | 339 | <methods>public final int getDialectProcessorPrecedence() ,public final java.lang.String getPrefix() <variables>private final non-sealed java.lang.String prefix,private final non-sealed int processorPrecedence |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-extrathyme/src/main/java/org/thymeleaf/examples/spring5/extrathyme/web/SpringWebConfig.java | SpringWebConfig | templateEngine | class SpringWebConfig implements WebMvcConfigurer, ApplicationContextAware {
private ApplicationContext applicationContext;
public SpringWebConfig() {
super();
}
public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
this.application... |
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setEnableSpringELCompiler(true); // Compiled SpringEL should speed up executions
templateEngine.setTemplateResolver(templateResolver());
templateEngine.addDialect(new ScoreDialect());
return templat... | 604 | 75 | 679 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-sayhello/src/main/java/org/thymeleaf/examples/spring5/sayhello/SpringWebApplicationInitializer.java | SpringWebApplicationInitializer | getServletFilters | class SpringWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
public static final String CHARACTER_ENCODING = "UTF-8";
public SpringWebApplicationInitializer() {
super();
}
@Override
protected Class<?>[] getServletConfigClasses() {
return ... |
final CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
encodingFilter.setEncoding(CHARACTER_ENCODING);
encodingFilter.setForceEncoding(true);
return new Filter[] { encodingFilter };
| 190 | 55 | 245 | <methods>public void <init>() <variables> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-sayhello/src/main/java/org/thymeleaf/examples/spring5/sayhello/dialect/HelloDialect.java | HelloDialect | getProcessors | class HelloDialect extends AbstractProcessorDialect {
public HelloDialect() {
super(
"Hello Dialect", // Dialect name
"hello", // Dialect prefix (hello:*)
1000); // Dialect precedence
}
/*
* Initialize the dialect... |
final Set<IProcessor> processors = new HashSet<IProcessor>();
processors.add(new SayToAttributeTagProcessor(dialectPrefix));
processors.add(new SayToPlanetAttributeTagProcessor(dialectPrefix));
// This will remove the xmlns:hello attributes we might add for IDE validation
proces... | 195 | 108 | 303 | <methods>public final int getDialectProcessorPrecedence() ,public final java.lang.String getPrefix() <variables>private final non-sealed java.lang.String prefix,private final non-sealed int processorPrecedence |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-sayhello/src/main/java/org/thymeleaf/examples/spring5/sayhello/dialect/SayToPlanetAttributeTagProcessor.java | SayToPlanetAttributeTagProcessor | doProcess | class SayToPlanetAttributeTagProcessor extends AbstractAttributeTagProcessor {
private static final String ATTR_NAME = "saytoplanet";
private static final int PRECEDENCE = 10000;
private static final String SAYTO_PLANET_MESSAGE = "msg.helloplanet";
public SayToPlanetAttributeTagProcessor(final S... |
/*
* In order to evaluate the attribute value as a Thymeleaf Standard Expression,
* we first obtain the parser, then use it for parsing the attribute value into
* an expression object, and finally execute this expression object.
*/
final IEngineConfiguration configu... | 296 | 387 | 683 | <methods><variables>private final non-sealed boolean removeAttribute |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-sayhello/src/main/java/org/thymeleaf/examples/spring5/sayhello/web/SpringWebConfig.java | SpringWebConfig | templateResolver | class SpringWebConfig implements WebMvcConfigurer, ApplicationContextAware {
private ApplicationContext applicationContext;
public SpringWebConfig() {
super();
}
public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
this.application... |
SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
templateResolver.setApplicationContext(this.applicationContext);
templateResolver.setPrefix("/WEB-INF/templates/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode(Templ... | 559 | 120 | 679 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-sayhello/src/main/java/org/thymeleaf/examples/spring5/sayhello/web/controller/SayHelloController.java | SayHelloController | populatePlanets | class SayHelloController {
public SayHelloController() {
super();
}
@ModelAttribute("planets")
public List<String> populatePlanets() {<FILL_FUNCTION_BODY>}
@RequestMapping({"/","/sayhello"})
public String showSayHello() {
return "sayhello";
}
} |
return Arrays.asList(new String[] {
"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"
});
| 99 | 56 | 155 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-springmail/src/main/java/org/thymeleaf/examples/spring5/springmail/SpringWebApplicationInitializer.java | SpringWebApplicationInitializer | getServletFilters | class SpringWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
public static final String CHARACTER_ENCODING = "UTF-8";
public SpringWebApplicationInitializer() {
super();
}
@Override
protected Class<?>[] getServletConfigClasses() {
return ... |
final CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
encodingFilter.setEncoding(CHARACTER_ENCODING);
encodingFilter.setForceEncoding(true);
return new Filter[] { encodingFilter };
| 201 | 55 | 256 | <methods>public void <init>() <variables> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-springmail/src/main/java/org/thymeleaf/examples/spring5/springmail/business/SpringMailConfig.java | SpringMailConfig | textTemplateResolver | class SpringMailConfig implements ApplicationContextAware, EnvironmentAware {
public static final String EMAIL_TEMPLATE_ENCODING = "UTF-8";
private static final String JAVA_MAIL_FILE = "classpath:mail/javamail.properties";
private static final String HOST = "mail.server.host";
private static final St... |
final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setOrder(Integer.valueOf(1));
templateResolver.setResolvablePatterns(Collections.singleton("text/*"));
templateResolver.setPrefix("/mail/");
templateResolver.setSuffix(".txt"... | 1,212 | 130 | 1,342 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-springmail/src/main/java/org/thymeleaf/examples/spring5/springmail/web/SpringWebConfig.java | SpringWebConfig | templateEngine | class SpringWebConfig implements WebMvcConfigurer, ApplicationContextAware {
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
/* *************************... |
// SpringTemplateEngine automatically applies SpringStandardDialect and
// enables Spring's own MessageSource message resolution mechanisms.
final SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver());
// Enablin... | 729 | 151 | 880 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-springmail/src/main/java/org/thymeleaf/examples/spring5/springmail/web/controller/ErrorController.java | ErrorController | exception | class ErrorController {
@ExceptionHandler(Throwable.class)
public ModelAndView exception(Throwable throwable) {<FILL_FUNCTION_BODY>}
} |
String errorMessage = throwable != null ? throwable.getMessage() : "Unknown error";
ModelAndView mav = new ModelAndView();
mav.getModel().put("errorMessage", errorMessage);
mav.setViewName("error");
return mav;
| 46 | 71 | 117 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-springmail/src/main/java/org/thymeleaf/examples/spring5/springmail/web/controller/SendingController.java | SendingController | sendMailWithAttachment | class SendingController {
@Autowired
private EmailService emailService;
/* Send plain TEXT mail */
@RequestMapping(value = "/sendMailText", method = POST)
public String sendTextMail(
@RequestParam("recipientName") final String recipientName,
@RequestParam("recipientEmail") final St... |
this.emailService.sendMailWithAttachment(
recipientName, recipientEmail, attachment.getOriginalFilename(),
attachment.getBytes(), attachment.getContentType(), locale);
return "redirect:sent.html";
| 673 | 59 | 732 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-stsm/src/main/java/org/thymeleaf/examples/spring5/stsm/SpringWebApplicationInitializer.java | SpringWebApplicationInitializer | getServletFilters | class SpringWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
public static final String CHARACTER_ENCODING = "UTF-8";
public SpringWebApplicationInitializer() {
super();
}
@Override
protected Class<?>[] getServletConfigClasses() {
return ... |
final CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
encodingFilter.setEncoding(CHARACTER_ENCODING);
encodingFilter.setForceEncoding(true);
return new Filter[] { encodingFilter };
| 195 | 55 | 250 | <methods>public void <init>() <variables> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-stsm/src/main/java/org/thymeleaf/examples/spring5/stsm/business/entities/Row.java | Row | toString | class Row {
private Variety variety = null;
private Integer seedsPerCell = null;
public Row() {
super();
}
public Variety getVariety() {
return this.variety;
}
public void setVariety(final Variety variety) {
this.variety = variety;
}
... |
return "Row [variety=" + this.variety + ", seedsPerCell=" + this.seedsPerCell + "]";
| 186 | 36 | 222 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-stsm/src/main/java/org/thymeleaf/examples/spring5/stsm/business/entities/SeedStarter.java | SeedStarter | toString | class SeedStarter {
private Integer id = null;
private Date datePlanted = null;
private Boolean covered = null;
private Type type = Type.PLASTIC;
private Feature[] features = null;
private List<Row> rows = new ArrayList<Row>();
public SeedStarter() {
super();
}
... |
return "SeedStarter [id=" + this.id + ", datePlanted=" + this.datePlanted
+ ", covered=" + this.covered + ", type=" + this.type + ", features="
+ Arrays.toString(this.features) + ", rows=" + this.rows + "]";
| 389 | 83 | 472 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-stsm/src/main/java/org/thymeleaf/examples/spring5/stsm/web/SpringWebConfig.java | SpringWebConfig | templateEngine | class SpringWebConfig implements WebMvcConfigurer, ApplicationContextAware {
private ApplicationContext applicationContext;
public SpringWebConfig() {
super();
}
public void setApplicationContext(final ApplicationContext applicationContext)
throws BeansException {
this.a... |
// SpringTemplateEngine automatically applies SpringStandardDialect and
// enables Spring's own MessageSource message resolution mechanisms.
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver());
// Enabling the ... | 815 | 150 | 965 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-stsm/src/main/java/org/thymeleaf/examples/spring5/stsm/web/controller/SeedStarterMngController.java | SeedStarterMngController | saveSeedstarter | class SeedStarterMngController {
@Autowired
private VarietyService varietyService;
@Autowired
private SeedStarterService seedStarterService;
public SeedStarterMngController() {
super();
}
@ModelAttribute("allTypes")
public List<Type> populateTypes... |
if (bindingResult.hasErrors()) {
return "seedstartermng";
}
this.seedStarterService.add(seedStarter);
model.clear();
return "redirect:/seedstartermng";
| 568 | 59 | 627 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-stsm/src/main/java/org/thymeleaf/examples/spring5/stsm/web/conversion/DateFormatter.java | DateFormatter | createDateFormat | class DateFormatter implements Formatter<Date> {
@Autowired
private MessageSource messageSource;
public DateFormatter() {
super();
}
public Date parse(final String text, final Locale locale) throws ParseException {
final SimpleDateFormat dateFormat = createDateFormat(locale);
... |
final String format = this.messageSource.getMessage("date.format", null, locale);
final SimpleDateFormat dateFormat = new SimpleDateFormat(format);
dateFormat.setLenient(false);
return dateFormat;
| 170 | 57 | 227 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-thvsjsp/src/main/java/org/thymeleaf/examples/spring5/thvsjsp/SpringWebApplicationInitializer.java | SpringWebApplicationInitializer | getServletFilters | class SpringWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
public static final String CHARACTER_ENCODING = "UTF-8";
public SpringWebApplicationInitializer() {
super();
}
@Override
protected Class<?>[] getServletConfigClasses() {
return ... |
final CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
encodingFilter.setEncoding(CHARACTER_ENCODING);
encodingFilter.setForceEncoding(true);
return new Filter[] { encodingFilter };
| 190 | 55 | 245 | <methods>public void <init>() <variables> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-thvsjsp/src/main/java/org/thymeleaf/examples/spring5/thvsjsp/business/entities/Subscription.java | Subscription | toString | class Subscription {
private String email;
private SubscriptionType subscriptionType = SubscriptionType.ALL_EMAILS;
public Subscription() {
super();
}
public String getEmail() {
return this.email;
}
public void setEmail(final String email) {
this.email ... |
return "Subscription [email=" + this.email + ", subscriptionType="
+ this.subscriptionType + "]";
| 186 | 35 | 221 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-thvsjsp/src/main/java/org/thymeleaf/examples/spring5/thvsjsp/web/SpringWebConfig.java | SpringWebConfig | templateEngine | class SpringWebConfig implements WebMvcConfigurer, ApplicationContextAware {
private ApplicationContext applicationContext;
public SpringWebConfig() {
super();
}
public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
this.application... |
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setEnableSpringELCompiler(true); // Compiled SpringEL should speed up executions
templateEngine.setTemplateResolver(templateResolver());
return templateEngine;
| 822 | 58 | 880 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-thvsjsp/src/main/java/org/thymeleaf/examples/spring5/thvsjsp/web/controller/SubscribeJsp.java | SubscribeJsp | subscribe | class SubscribeJsp {
private static final Logger log = LoggerFactory.getLogger(SubscribeJsp.class);
public SubscribeJsp() {
super();
}
@ModelAttribute("allTypes")
public SubscriptionType[] populateTypes() {
return new SubscriptionType[] { SubscriptionType.A... |
if (bindingResult.hasErrors()) {
return "subscribejsp";
}
log.info("JUST ADDED SUBSCRIPTION: " + subscription);
model.clear();
return "redirect:/subscribejsp";
| 220 | 61 | 281 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring5/thymeleaf-examples-spring5-thvsjsp/src/main/java/org/thymeleaf/examples/spring5/thvsjsp/web/controller/SubscribeTh.java | SubscribeTh | subscribe | class SubscribeTh {
private static final Logger log = LoggerFactory.getLogger(SubscribeTh.class);
public SubscribeTh() {
super();
}
@ModelAttribute("allTypes")
public SubscriptionType[] populateTypes() {
return new SubscriptionType[] { SubscriptionType.ALL_... |
if (bindingResult.hasErrors()) {
return "subscribeth";
}
log.info("JUST ADDED SUBSCRIPTION: " + subscription);
model.clear();
return "redirect:/subscribeth";
| 220 | 63 | 283 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-extrathyme/src/main/java/org/thymeleaf/examples/spring6/extrathyme/SpringWebApplicationInitializer.java | SpringWebApplicationInitializer | getServletFilters | class SpringWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
public static final String CHARACTER_ENCODING = "UTF-8";
public SpringWebApplicationInitializer() {
super();
}
@Override
protected Class<?>[] getServletConfigClasses() {
return ... |
final CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
encodingFilter.setEncoding(CHARACTER_ENCODING);
encodingFilter.setForceEncoding(true);
return new Filter[] { encodingFilter };
| 195 | 55 | 250 | <methods>public void <init>() <variables> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-extrathyme/src/main/java/org/thymeleaf/examples/spring6/extrathyme/business/entities/Headline.java | Headline | compareTo | class Headline
implements Comparable<Headline> {
private final Calendar date;
private final String text;
public Headline(final Calendar date, final String text) {
super();
this.date = date;
this.text = text;
}
public Calendar getDate() {
re... |
if (o == null) {
return 1;
}
return this.date.compareTo(o.date);
| 151 | 35 | 186 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-extrathyme/src/main/java/org/thymeleaf/examples/spring6/extrathyme/business/entities/repositories/HeadlineRepository.java | HeadlineRepository | findAllHeadlines | class HeadlineRepository {
public HeadlineRepository() {
super();
}
public List<Headline> findAllHeadlines() {<FILL_FUNCTION_BODY>}
} |
final List<Headline> headlines = new ArrayList<Headline>();
headlines.add(new Headline(Calendar.getInstance(), "Spearmint Caterpillars 1 - 0 Parsley Warriors"));
headlines.add(new Headline(Calendar.getInstance(), "Laurel Troglodytes 1 - 1 Rosemary 75ers"));
headlines.a... | 62 | 205 | 267 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-extrathyme/src/main/java/org/thymeleaf/examples/spring6/extrathyme/business/entities/repositories/TeamRepository.java | TeamRepository | findAllTeams | class TeamRepository {
public TeamRepository() {
super();
}
public List<Team> findAllTeams() {<FILL_FUNCTION_BODY>}
} |
final List<Team> teams = new ArrayList<Team>();
teams.add(new Team("SPC", "Spearmint Caterpillars", 73, 21, 10, 5));
teams.add(new Team("BAD", "Basil Dragons", 72, 21, 9, 6));
teams.add(new Team("SPS", "Sweet Paprika Savages", 57, 15, 12, 9));
teams.add(new Tea... | 59 | 380 | 439 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-extrathyme/src/main/java/org/thymeleaf/examples/spring6/extrathyme/business/util/RemarkUtil.java | RemarkUtil | getRemarkForPosition | class RemarkUtil {
public static Remark getRemarkForPosition(final Integer position) {<FILL_FUNCTION_BODY>}
private RemarkUtil() {
super();
}
} |
if (position == null) {
return null;
}
switch (position.intValue()) {
case 1: return Remark.WORLD_CHAMPIONS_LEAGUE;
case 2:
case 3: return Remark.CONTINENTAL_PLAYOFFS;
case 10: return Remark.RELEGATION;
}
retur... | 59 | 106 | 165 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-extrathyme/src/main/java/org/thymeleaf/examples/spring6/extrathyme/dialects/score/ClassForPositionAttributeTagProcessor.java | ClassForPositionAttributeTagProcessor | doProcess | class ClassForPositionAttributeTagProcessor extends AbstractAttributeTagProcessor {
private static final String ATTR_NAME = "classforposition";
private static final int PRECEDENCE = 10000;
public ClassForPositionAttributeTagProcessor(final String dialectPrefix) {
super(
TemplateMode.H... |
final IEngineConfiguration configuration = context.getConfiguration();
/*
* Obtain the Thymeleaf Standard Expression parser
*/
final IStandardExpressionParser parser =
StandardExpressions.getExpressionParser(configuration);
/*
* Parse the at... | 269 | 398 | 667 | <methods><variables>private final non-sealed boolean removeAttribute |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-extrathyme/src/main/java/org/thymeleaf/examples/spring6/extrathyme/dialects/score/HeadlinesElementTagProcessor.java | HeadlinesElementTagProcessor | doProcess | class HeadlinesElementTagProcessor extends AbstractElementTagProcessor {
private static final String TAG_NAME = "headlines";
private static final int PRECEDENCE = 1000;
private final Random rand = new Random(System.currentTimeMillis());
public HeadlinesElementTagProcessor(final String dialectPrefix... |
/*
* Obtain the Spring application context.
*/
final ApplicationContext appCtx = SpringContextUtils.getApplicationContext(context);
/*
* Obtain the HeadlineRepository bean from the application context, and ask
* it for the current list of headlines.
... | 264 | 518 | 782 | <methods>public void <init>(org.thymeleaf.templatemode.TemplateMode, java.lang.String, java.lang.String, boolean, java.lang.String, boolean, int) ,public final org.thymeleaf.processor.element.MatchingAttributeName getMatchingAttributeName() ,public final org.thymeleaf.processor.element.MatchingElementName getMatchingEl... |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-extrathyme/src/main/java/org/thymeleaf/examples/spring6/extrathyme/dialects/score/MatchDayTodayModelProcessor.java | MatchDayTodayModelProcessor | checkPositionInMarkup | class MatchDayTodayModelProcessor extends AbstractAttributeModelProcessor {
private static final String ATTR_NAME = "match-day-today";
private static final int PRECEDENCE = 100;
public MatchDayTodayModelProcessor(final String dialectPrefix) {
super(
TemplateMode.HTML, // This processo... |
/*
* We want to make sure this processor is being applied inside a container tag which has
* class="leaguetable". So we need to check the second-to-last entry in the element stack
* (the last entry is the tag being processed itself).
*/
final List<IProcessableEleme... | 569 | 193 | 762 | <methods><variables>private final non-sealed boolean removeAttribute |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-extrathyme/src/main/java/org/thymeleaf/examples/spring6/extrathyme/dialects/score/RemarkForPositionAttributeTagProcessor.java | RemarkForPositionAttributeTagProcessor | doProcess | class RemarkForPositionAttributeTagProcessor extends AbstractAttributeTagProcessor {
private static final String ATTR_NAME = "remarkforposition";
private static final int PRECEDENCE = 12000;
public RemarkForPositionAttributeTagProcessor(final String dialectPrefix) {
super(
TemplateMod... |
final IEngineConfiguration configuration = context.getConfiguration();
/*
* Obtain the Thymeleaf Standard Expression parser
*/
final IStandardExpressionParser parser =
StandardExpressions.getExpressionParser(configuration);
/*
* Parse the at... | 269 | 460 | 729 | <methods><variables>private final non-sealed boolean removeAttribute |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-extrathyme/src/main/java/org/thymeleaf/examples/spring6/extrathyme/dialects/score/ScoreDialect.java | ScoreDialect | getProcessors | class ScoreDialect extends AbstractProcessorDialect {
private static final String DIALECT_NAME = "Score Dialect";
public ScoreDialect() {
// We will set this dialect the same "dialect processor" precedence as
// the Standard Dialect, so that processor executions can interleave.
super(... |
final Set<IProcessor> processors = new HashSet<IProcessor>();
processors.add(new ClassForPositionAttributeTagProcessor(dialectPrefix));
processors.add(new RemarkForPositionAttributeTagProcessor(dialectPrefix));
processors.add(new HeadlinesElementTagProcessor(dialectPrefix));
pro... | 192 | 147 | 339 | <methods>public final int getDialectProcessorPrecedence() ,public final java.lang.String getPrefix() <variables>private final non-sealed java.lang.String prefix,private final non-sealed int processorPrecedence |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-extrathyme/src/main/java/org/thymeleaf/examples/spring6/extrathyme/web/SpringWebConfig.java | SpringWebConfig | templateResolver | class SpringWebConfig implements WebMvcConfigurer, ApplicationContextAware {
private ApplicationContext applicationContext;
public SpringWebConfig() {
super();
}
public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
this.application... |
SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
templateResolver.setApplicationContext(this.applicationContext);
templateResolver.setPrefix("/WEB-INF/templates/");
templateResolver.setSuffix(".html");
templateResolver.setTemplateMode(Templ... | 559 | 120 | 679 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-sayhello/src/main/java/org/thymeleaf/examples/spring6/sayhello/SpringWebApplicationInitializer.java | SpringWebApplicationInitializer | getServletFilters | class SpringWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
public static final String CHARACTER_ENCODING = "UTF-8";
public SpringWebApplicationInitializer() {
super();
}
@Override
protected Class<?>[] getServletConfigClasses() {
return ... |
final CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
encodingFilter.setEncoding(CHARACTER_ENCODING);
encodingFilter.setForceEncoding(true);
return new Filter[] { encodingFilter };
| 190 | 55 | 245 | <methods>public void <init>() <variables> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-sayhello/src/main/java/org/thymeleaf/examples/spring6/sayhello/dialect/HelloDialect.java | HelloDialect | getProcessors | class HelloDialect extends AbstractProcessorDialect {
public HelloDialect() {
super(
"Hello Dialect", // Dialect name
"hello", // Dialect prefix (hello:*)
1000); // Dialect precedence
}
/*
* Initialize the dialect... |
final Set<IProcessor> processors = new HashSet<IProcessor>();
processors.add(new SayToAttributeTagProcessor(dialectPrefix));
processors.add(new SayToPlanetAttributeTagProcessor(dialectPrefix));
// This will remove the xmlns:hello attributes we might add for IDE validation
proces... | 195 | 108 | 303 | <methods>public final int getDialectProcessorPrecedence() ,public final java.lang.String getPrefix() <variables>private final non-sealed java.lang.String prefix,private final non-sealed int processorPrecedence |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-sayhello/src/main/java/org/thymeleaf/examples/spring6/sayhello/dialect/SayToPlanetAttributeTagProcessor.java | SayToPlanetAttributeTagProcessor | doProcess | class SayToPlanetAttributeTagProcessor extends AbstractAttributeTagProcessor {
private static final String ATTR_NAME = "saytoplanet";
private static final int PRECEDENCE = 10000;
private static final String SAYTO_PLANET_MESSAGE = "msg.helloplanet";
public SayToPlanetAttributeTagProcessor(final S... |
/*
* In order to evaluate the attribute value as a Thymeleaf Standard Expression,
* we first obtain the parser, then use it for parsing the attribute value into
* an expression object, and finally execute this expression object.
*/
final IEngineConfiguration configu... | 296 | 387 | 683 | <methods><variables>private final non-sealed boolean removeAttribute |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-sayhello/src/main/java/org/thymeleaf/examples/spring6/sayhello/web/SpringWebConfig.java | SpringWebConfig | templateEngine | class SpringWebConfig implements WebMvcConfigurer, ApplicationContextAware {
private ApplicationContext applicationContext;
public SpringWebConfig() {
super();
}
public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
this.application... |
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setEnableSpringELCompiler(true); // Compiled SpringEL should speed up executions
templateEngine.setTemplateResolver(templateResolver());
templateEngine.addDialect(new HelloDialect());
return templat... | 604 | 75 | 679 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-sayhello/src/main/java/org/thymeleaf/examples/spring6/sayhello/web/controller/SayHelloController.java | SayHelloController | populatePlanets | class SayHelloController {
public SayHelloController() {
super();
}
@ModelAttribute("planets")
public List<String> populatePlanets() {<FILL_FUNCTION_BODY>}
@RequestMapping({"/","/sayhello"})
public String showSayHello() {
return "sayhello";
}
} |
return Arrays.asList(new String[] {
"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"
});
| 99 | 56 | 155 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-springmail/src/main/java/org/thymeleaf/examples/spring6/springmail/SpringWebApplicationInitializer.java | SpringWebApplicationInitializer | getServletFilters | class SpringWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
public static final String CHARACTER_ENCODING = "UTF-8";
public SpringWebApplicationInitializer() {
super();
}
@Override
protected Class<?>[] getServletConfigClasses() {
return ... |
final CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
encodingFilter.setEncoding(CHARACTER_ENCODING);
encodingFilter.setForceEncoding(true);
return new Filter[] { encodingFilter };
| 340 | 55 | 395 | <methods>public void <init>() <variables> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-springmail/src/main/java/org/thymeleaf/examples/spring6/springmail/business/SpringMailConfig.java | SpringMailConfig | htmlTemplateResolver | class SpringMailConfig implements ApplicationContextAware, EnvironmentAware {
public static final String EMAIL_TEMPLATE_ENCODING = "UTF-8";
private static final String JAVA_MAIL_FILE = "classpath:mail/javamail.properties";
private static final String HOST = "mail.server.host";
private static final St... |
final ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
templateResolver.setOrder(Integer.valueOf(2));
templateResolver.setResolvablePatterns(Collections.singleton("html/*"));
templateResolver.setPrefix("/mail/");
templateResolver.setSuffix(".html... | 1,212 | 130 | 1,342 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-springmail/src/main/java/org/thymeleaf/examples/spring6/springmail/web/SpringWebConfig.java | SpringWebConfig | templateEngine | class SpringWebConfig implements WebMvcConfigurer, ApplicationContextAware {
private ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
/* *************************... |
// SpringTemplateEngine automatically applies SpringStandardDialect and
// enables Spring's own MessageSource message resolution mechanisms.
final SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.setTemplateResolver(templateResolver());
// Enablin... | 689 | 151 | 840 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-springmail/src/main/java/org/thymeleaf/examples/spring6/springmail/web/controller/ErrorController.java | ErrorController | exception | class ErrorController {
@ExceptionHandler(Throwable.class)
public ModelAndView exception(Throwable throwable) {<FILL_FUNCTION_BODY>}
} |
String errorMessage = throwable != null ? throwable.getMessage() : "Unknown error";
ModelAndView mav = new ModelAndView();
mav.getModel().put("errorMessage", errorMessage);
mav.setViewName("error");
return mav;
| 46 | 71 | 117 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-springmail/src/main/java/org/thymeleaf/examples/spring6/springmail/web/controller/SendingController.java | SendingController | sendMailWithInline | class SendingController {
@Autowired
private EmailService emailService;
/* Send plain TEXT mail */
@RequestMapping(value = "/sendMailText", method = POST)
public String sendTextMail(
@RequestParam("recipientName") final String recipientName,
@RequestParam("recipientEmail") final St... |
this.emailService.sendMailWithInline(
recipientName, recipientEmail, image.getName(),
image.getBytes(), image.getContentType(), locale);
return "redirect:sent.html";
| 676 | 56 | 732 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-stsm/src/main/java/org/thymeleaf/examples/spring6/stsm/SpringWebApplicationInitializer.java | SpringWebApplicationInitializer | getServletFilters | class SpringWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
public static final String CHARACTER_ENCODING = "UTF-8";
public SpringWebApplicationInitializer() {
super();
}
@Override
protected Class<?>[] getServletConfigClasses() {
return ... |
final CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
encodingFilter.setEncoding(CHARACTER_ENCODING);
encodingFilter.setForceEncoding(true);
return new Filter[] { encodingFilter };
| 195 | 55 | 250 | <methods>public void <init>() <variables> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-stsm/src/main/java/org/thymeleaf/examples/spring6/stsm/business/entities/Row.java | Row | toString | class Row {
private Variety variety = null;
private Integer seedsPerCell = null;
public Row() {
super();
}
public Variety getVariety() {
return this.variety;
}
public void setVariety(final Variety variety) {
this.variety = variety;
}
... |
return "Row [variety=" + this.variety + ", seedsPerCell=" + this.seedsPerCell + "]";
| 186 | 36 | 222 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-stsm/src/main/java/org/thymeleaf/examples/spring6/stsm/business/entities/SeedStarter.java | SeedStarter | toString | class SeedStarter {
private Integer id = null;
private Date datePlanted = null;
private Boolean covered = null;
private Type type = Type.PLASTIC;
private Feature[] features = null;
private List<Row> rows = new ArrayList<Row>();
public SeedStarter() {
super();
}
... |
return "SeedStarter [id=" + this.id + ", datePlanted=" + this.datePlanted
+ ", covered=" + this.covered + ", type=" + this.type + ", features="
+ Arrays.toString(this.features) + ", rows=" + this.rows + "]";
| 389 | 83 | 472 | <no_super_class> |
thymeleaf_thymeleaf | thymeleaf/examples/spring6/thymeleaf-examples-spring6-stsm/src/main/java/org/thymeleaf/examples/spring6/stsm/web/SpringWebConfig.java | SpringWebConfig | templateResolver | class SpringWebConfig implements WebMvcConfigurer, ApplicationContextAware {
private ApplicationContext applicationContext;
public SpringWebConfig() {
super();
}
public void setApplicationContext(final ApplicationContext applicationContext)
throws BeansException {
this.a... |
// SpringResourceTemplateResolver automatically integrates with Spring's own
// resource resolution infrastructure, which is highly recommended.
SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
templateResolver.setApplicationContext(this.applicatio... | 801 | 164 | 965 | <no_super_class> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.