View Sealed.java
package com.example.geometry; | |
public abstract sealed class Shape | |
permits Circle, Rectangle, Square { ... } | |
public final class Circle extends Shape { ... } | |
public sealed class Rectangle extends Shape | |
permits TransparentRectangle, FilledRectangle { ... } | |
public final class TransparentRectangle extends Rectangle { ... } |
View Api.java
@Operation( | |
summary = "List all entries from database", | |
description = "Returns all entries that was saved to our database" | |
) | |
@ApiResponses(value = { | |
@ApiResponse(responseCode = "200", description = "Entry was added to database"), | |
@ApiResponse(responseCode = "500", description = "Something went wrong, entry was not added") | |
}) | |
@GetMapping("/api/list") |
View CustomValidatorController.java
@RestController | |
public class CustomValidatorController { | |
@PostMapping("/zipCode") | |
@ResponseBody | |
public String zipCodeBody( | |
@RequestBody @Valid RequestWithZipCode body // #1 | |
) { | |
return "OK! Everything is valid"; | |
} | |
} |
View Dockerfile
FROM adoptopenjdk/openjdk14:alpine-jre | |
WORKDIR /opt | |
COPY target/spring-docker.jar application.jar | |
ENTRYPOINT ["java", "-jar", "application.jar"] |
View Pet.java
public class Pet { | |
@NotBlank | |
private String name; | |
public Pet(@NotBlank String name) { | |
this.name = name; | |
} | |
public String getName() { | |
return name; |
View TitleSearch.java
import java.util.*; | |
import java.util.concurrent.atomic.AtomicInteger; | |
public class TitleSearch { | |
public static void main(String[] args) { | |
final Scanner sc = new Scanner(System.in); | |
List<String> titles = new ArrayList<>(); | |
final int n = sc.nextInt(); | |
sc.nextLine(); |
View TitleSearch.java
public class TitleSearch { | |
public static void main(String[] args) { | |
final Scanner sc = new Scanner(System.in); | |
List<String> titles = new ArrayList<>(); | |
final int n = sc.nextInt(); | |
sc.nextLine(); | |
for (int i = 0; i < n; ++i) { | |
titles.add(sc.nextLine()); | |
} |
View action.php
<?php | |
/* | |
* Plugin Name: Sample Extension | |
* Plugin URI: http://wpblog.pl | |
* Description: Sample Extension to show wordpress plugins functionality | |
* Version: 1.0 | |
* Author: WP Blog | |
* Author URI: http://wpblog.pl | |
*/ |
View Client.java
Vision visionClient = new Vision.Builder(httpTransport, jsonFactory, credential) | |
.setApplicationName(APPLICATION_NAME) | |
.build(); |
View ManyToMany.java
@ManyToMany | |
private List<Project> projects; |
NewerOlder