Merge branch 'master' into master

This commit is contained in:
Ahmed Tawila
2017-09-16 20:47:17 +02:00
committed by GitHub
142 changed files with 2597 additions and 1507 deletions
+1
View File
@@ -8,3 +8,4 @@
- [Check If a Number Is Prime in Java](http://www.baeldung.com/java-prime-numbers)
- [Example of Hill Climbing Algorithm](http://www.baeldung.com/java-hill-climbing-algorithm)
- [Monte Carlo Tree Search for Tic-Tac-Toe Game](http://www.baeldung.com/java-monte-carlo-tree-search)
- [String Search Algorithms for Large Texts](http://www.baeldung.com/java-full-text-search-algorithms)
+2
View File
@@ -0,0 +1,2 @@
### Relevant articles
- [Introduction to Apache Shiro](http://www.baeldung.com/apache-shiro)
+2
View File
@@ -0,0 +1,2 @@
### Relevant Articles:
- [Introduction to Bootique](http://www.baeldung.com/bootique)
+1
View File
@@ -16,3 +16,4 @@
- [Java 9 Optional API Additions](http://www.baeldung.com/java-9-optional)
- [Java 9 Reactive Streams](http://www.baeldung.com/java-9-reactive-streams)
- [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates)
- [Java 9 java.util.Objects Additions](http://www.baeldung.com/java-9-objects-new)
@@ -18,7 +18,7 @@ public class BaeldungSychronizedBlockTest {
IntStream.range(0, 1000)
.forEach(count -> service.submit(synchronizedBlocks::performSynchronisedTask));
service.awaitTermination(100, TimeUnit.MILLISECONDS);
service.awaitTermination(500, TimeUnit.MILLISECONDS);
assertEquals(1000, synchronizedBlocks.getCount());
}
@@ -29,7 +29,7 @@ public class BaeldungSychronizedBlockTest {
IntStream.range(0, 1000)
.forEach(count -> service.submit(BaeldungSynchronizedBlocks::performStaticSyncTask));
service.awaitTermination(100, TimeUnit.MILLISECONDS);
service.awaitTermination(500, TimeUnit.MILLISECONDS);
assertEquals(1000, BaeldungSynchronizedBlocks.getStaticCount());
}
+6
View File
@@ -99,4 +99,10 @@
- [ClassNotFoundException vs NoClassDefFoundError](http://www.baeldung.com/java-classnotfoundexception-and-noclassdeffounderror)
- [Guide to UUID in Java](http://www.baeldung.com/java-uuid)
- [Guide to Escaping Characters in Java RegExps](http://www.baeldung.com/java-regexp-escape-char)
- [Guide to hashCode() in Java](http://www.baeldung.com/java-hashcode)
- [Collect a Java Stream to an Immutable Collection](http://www.baeldung.com/java-stream-immutable-collection)
- [Difference between URL and URI](http://www.baeldung.com/java-url-vs-uri)
- [Broadcasting and Multicasting in Java](http://www.baeldung.com/java-broadcast-multicast)
- [Converting a List to String in Java](http://www.baeldung.com/java-list-to-string)
- [CharSequence vs. String in Java](http://www.baeldung.com/java-char-sequence-string)
- [Period and Duration in Java](http://www.baeldung.com/java-period-duration)
+32 -24
View File
@@ -211,6 +211,11 @@
<artifactId>jmh-generator-annprocess</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
</dependencies>
<build>
@@ -239,6 +244,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*LiveTest.java</exclude>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*LongRunningUnitTest.java</exclude>
<exclude>**/*ManualTest.java</exclude>
@@ -373,30 +379,7 @@
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>run-benchmarks</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<classpathScope>test</classpathScope>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>org.openjdk.jmh.Main</argument>
<argument>.*</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -431,6 +414,31 @@
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>run-benchmarks</id>
<!-- <phase>integration-test</phase>-->
<phase>none</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<classpathScope>test</classpathScope>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>org.openjdk.jmh.Main</argument>
<argument>.*</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
@@ -461,7 +469,7 @@
<protonpack.version>1.13</protonpack.version>
<streamex.version>0.6.5</streamex.version>
<vavr.version>0.9.0</vavr.version>
<!-- testing -->
<org.hamcrest.version>1.3</org.hamcrest.version>
<junit.version>4.12</junit.version>
@@ -1,20 +1,23 @@
package com.baeldung.encoderdecoder;
import static java.util.stream.Collectors.joining;
import static org.hamcrest.CoreMatchers.is;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.UnsupportedEncodingException;
import java.net.*;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import static java.util.stream.Collectors.joining;
import static org.hamcrest.CoreMatchers.*;
import org.springframework.web.util.UriUtils;
public class EncoderDecoderUnitTest {
@@ -76,19 +79,20 @@ public class EncoderDecoderUnitTest {
private String encodePath(String path) {
try {
path = new URI(null, null, path, null).getPath();
} catch (URISyntaxException e) {
path = UriUtils.encodePath(path, "UTF-8");
} catch (UnsupportedEncodingException e) {
LOGGER.error("Error encoding parameter {}", e.getMessage(), e);
}
return path;
}
@Test
public void givenPath_thenEncodeDecodePath() throws URISyntaxException {
URI uri = new URI(null, null, "/Path 1/Path+2", null);
Assert.assertEquals("/Path 1/Path+2", uri.getPath());
Assert.assertEquals("/Path%201/Path+2", uri.getRawPath());
public void givenPathSegment_thenEncodeDecode() throws UnsupportedEncodingException {
String pathSegment = "/Path 1/Path+2";
String encodedPathSegment = encodePath(pathSegment);
String decodedPathSegment = UriUtils.decode(encodedPathSegment, "UTF-8");
Assert.assertEquals("/Path%201/Path+2", encodedPathSegment);
Assert.assertEquals("/Path 1/Path+2", decodedPathSegment);
}
@Test
@@ -8,10 +8,10 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class NioEchoIntegrationTest {
public class NioEchoLiveTest {
Process server;
EchoClient client;
private Process server;
private EchoClient client;
@Before
public void setup() throws IOException, InterruptedException {
@@ -21,9 +21,9 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class JdbcIntegrationTest {
public class JdbcLiveTest {
private static final Logger LOG = Logger.getLogger(JdbcIntegrationTest.class);
private static final Logger LOG = Logger.getLogger(JdbcLiveTest.class);
private Connection con;
@@ -9,7 +9,7 @@ import java.io.IOException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
public class UDPIntegrationTest {
public class UDPLiveTest {
private EchoClient client;
@Before
@@ -7,7 +7,7 @@ import java.io.IOException;
import static org.junit.Assert.assertEquals;
public class BroadcastIntegrationTest {
public class BroadcastLiveTest {
private BroadcastingClient client;
@Test
@@ -7,7 +7,7 @@ import java.io.IOException;
import static org.junit.Assert.assertEquals;
public class MulticastIntegrationTest {
public class MulticastLiveTest {
private MulticastingClient client;
@Test
@@ -7,7 +7,7 @@ import java.io.File;
import static org.junit.Assert.assertTrue;
public class ScreenshotIntegrationTest {
public class ScreenshotLiveTest {
private Screenshot screenshot = new Screenshot("Screenshot.jpg");
private File file = new File("Screenshot.jpg");
@@ -0,0 +1,5 @@
package org.baeldung.java.diamond;
public class Car<T extends Engine> implements Vehicle<T> {
}
@@ -0,0 +1,13 @@
package org.baeldung.java.diamond;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
public class DiamondOperatorUnitTest {
@Test
public void whenCreateCarUsingDiamondOperator_thenSuccess() {
Car<Diesel> myCar = new Car<>();
assertNotNull(myCar);
}
}
@@ -0,0 +1,10 @@
package org.baeldung.java.diamond;
public class Diesel implements Engine {
@Override
public void start() {
System.out.println("Started Diesel...");
}
}
@@ -0,0 +1,6 @@
package org.baeldung.java.diamond;
public interface Engine {
void start();
}
@@ -0,0 +1,5 @@
package org.baeldung.java.diamond;
public interface Vehicle<T extends Engine> {
}
@@ -0,0 +1,17 @@
package org.baeldung.java.rawtypes;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
public class RawTypesTest {
@Test
public void shouldCreateListUsingRawTypes() {
@SuppressWarnings("rawtypes")
List myList = new ArrayList();
myList.add(new Object());
myList.add("2");
myList.add(new Integer(1));
}
}
+74
View File
@@ -0,0 +1,74 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId>
<artifactId>geotools</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>geotools</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>${geotools-shapefile.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-swing</artifactId>
<version>${geotools-swing.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>opengeo</id>
<name>OpenGeo Maven Repository</name>
<url>http://repo.opengeo.org</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<geotools.version>15.2</geotools.version>
<geotools-swing.version>15.2</geotools-swing.version>
<geotools-shapefile.version>15.2</geotools-shapefile.version>
</properties>
</project>
@@ -1,12 +1,8 @@
package com.baeldung.geotools;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;
import org.geotools.data.DataUtilities;
import org.geotools.data.DefaultTransaction;
import org.geotools.data.Transaction;
@@ -23,9 +19,13 @@ import org.geotools.swing.data.JFileDataStoreChooser;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
public class ShapeFile {
@@ -41,22 +41,117 @@ public class ShapeFile {
SimpleFeatureType CITY = createFeatureType();
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(CITY);
addLocations(featureBuilder, collection);
addLocations(CITY, collection);
File shapeFile = getNewShapeFile();
ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory();
Map<String, Serializable> params = new HashMap<String, Serializable>();
ShapefileDataStore dataStore = setDataStoreParams(dataStoreFactory, params, shapeFile, CITY);
writeToFile(dataStore, collection);
}
static SimpleFeatureType createFeatureType() {
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName("Location");
builder.setCRS(DefaultGeographicCRS.WGS84);
builder.add("Location", Point.class);
builder.length(15)
.add("Name", String.class);
return builder.buildFeatureType();
}
static void addLocations(SimpleFeatureType CITY, DefaultFeatureCollection collection) {
Map<String, List<Double>> locations = new HashMap<>();
double lat = 13.752222;
double lng = 100.493889;
addToLocationMap("Bangkok", lat, lng, locations);
lat = 53.083333;
lng = -0.15;
addToLocationMap("New York", lat, lng, locations);
lat = -33.925278;
lng = 18.423889;
addToLocationMap("Cape Town", lat, lng, locations);
lat = -33.859972;
lng = 151.211111;
addToLocationMap("Sydney", lat, lng, locations);
lat = 45.420833;
lng = -75.69;
addToLocationMap("Ottawa", lat, lng, locations);
lat = 30.07708;
lng = 31.285909;
addToLocationMap("Cairo", lat, lng, locations);
GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
locations.entrySet().stream()
.map(toFeature(CITY, geometryFactory))
.forEach(collection::add);
}
private static Function<Map.Entry<String, List<Double>>, SimpleFeature> toFeature(SimpleFeatureType CITY, GeometryFactory geometryFactory) {
return location -> {
Point point = geometryFactory.createPoint(
new Coordinate(location.getValue()
.get(0), location.getValue().get(1)));
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(CITY);
featureBuilder.add(point);
featureBuilder.add(location.getKey());
return featureBuilder.buildFeature(null);
};
}
private static void addToLocationMap(String name, double lat, double lng, Map<String, List<Double>> locations) {
List<Double> coordinates = new ArrayList<>();
coordinates.add(lat);
coordinates.add(lng);
locations.put(name, coordinates);
}
private static File getNewShapeFile() {
String filePath = new File(".").getAbsolutePath() + FILE_NAME;
JFileDataStoreChooser chooser = new JFileDataStoreChooser("shp");
chooser.setDialogTitle("Save shapefile");
chooser.setSelectedFile(new File(filePath));
int returnVal = chooser.showSaveDialog(null);
if (returnVal != JFileDataStoreChooser.APPROVE_OPTION) {
System.exit(0);
}
return chooser.getSelectedFile();
}
private static ShapefileDataStore setDataStoreParams(ShapefileDataStoreFactory dataStoreFactory, Map<String, Serializable> params, File shapeFile, SimpleFeatureType CITY) throws Exception {
params.put("url", shapeFile.toURI()
.toURL());
.toURL());
params.put("create spatial index", Boolean.TRUE);
ShapefileDataStore dataStore = (ShapefileDataStore) dataStoreFactory.createNewDataStore(params);
dataStore.createSchema(CITY);
return dataStore;
}
private static void writeToFile(ShapefileDataStore dataStore, DefaultFeatureCollection collection) throws Exception {
// If you decide to use the TYPE type and create a Data Store with it,
// You will need to uncomment this line to set the Coordinate Reference System
// newDataStore.forceSchemaCRS(DefaultGeographicCRS.WGS84);
@@ -73,11 +168,9 @@ public class ShapeFile {
try {
featureStore.addFeatures(collection);
transaction.commit();
} catch (Exception problem) {
problem.printStackTrace();
transaction.rollback();
} finally {
transaction.close();
}
@@ -86,102 +179,5 @@ public class ShapeFile {
System.out.println(typeName + " does not support read/write access");
System.exit(1);
}
}
public static SimpleFeatureType createFeatureType() {
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName("Location");
builder.setCRS(DefaultGeographicCRS.WGS84);
builder.add("Location", Point.class);
builder.length(15)
.add("Name", String.class);
SimpleFeatureType CITY = builder.buildFeatureType();
return CITY;
}
public static void addLocations(SimpleFeatureBuilder featureBuilder, DefaultFeatureCollection collection) {
Map<String, List<Double>> locations = new HashMap<>();
double lat = 13.752222;
double lng = 100.493889;
String name = "Bangkok";
addToLocationMap(name, lat, lng, locations);
lat = 53.083333;
lng = -0.15;
name = "New York";
addToLocationMap(name, lat, lng, locations);
lat = -33.925278;
lng = 18.423889;
name = "Cape Town";
addToLocationMap(name, lat, lng, locations);
lat = -33.859972;
lng = 151.211111;
name = "Sydney";
addToLocationMap(name, lat, lng, locations);
lat = 45.420833;
lng = -75.69;
name = "Ottawa";
addToLocationMap(name, lat, lng, locations);
lat = 30.07708;
lng = 31.285909;
name = "Cairo";
addToLocationMap(name, lat, lng, locations);
GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
for (Map.Entry<String, List<Double>> location : locations.entrySet()) {
Point point = geometryFactory.createPoint(new Coordinate(location.getValue()
.get(0),
location.getValue()
.get(1)));
featureBuilder.add(point);
featureBuilder.add(name);
SimpleFeature feature = featureBuilder.buildFeature(null);
collection.add(feature);
}
}
private static void addToLocationMap(String name, double lat, double lng, Map<String, List<Double>> locations) {
List<Double> coordinates = new ArrayList<>();
coordinates.add(lat);
coordinates.add(lng);
locations.put(name, coordinates);
}
private static File getNewShapeFile() {
String filePath = new File(".").getAbsolutePath() + FILE_NAME;
JFileDataStoreChooser chooser = new JFileDataStoreChooser("shp");
chooser.setDialogTitle("Save shapefile");
chooser.setSelectedFile(new File(filePath));
int returnVal = chooser.showSaveDialog(null);
if (returnVal != JFileDataStoreChooser.APPROVE_OPTION) {
System.exit(0);
}
File shapeFile = chooser.getSelectedFile();
if (shapeFile.equals(filePath)) {
System.out.println("Error: cannot replace " + filePath);
System.exit(0);
}
return shapeFile;
}
}
@@ -7,21 +7,16 @@ import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.junit.Test;
import org.opengis.feature.simple.SimpleFeatureType;
public class GeoToolsUnitTestTest {
public class GeoToolsUnitTest {
@Test
public void givenFeatureType_whenAddLocations_returnFeatureCollection() {
DefaultFeatureCollection collection = new DefaultFeatureCollection();
SimpleFeatureType CITY = ShapeFile.createFeatureType();
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(CITY);
ShapeFile.addLocations(featureBuilder, collection);
ShapeFile.addLocations(CITY, collection);
assertNotNull(collection);
}
}
+2
View File
@@ -0,0 +1,2 @@
### Relevant Articles:
- [Introduction to gRPC](http://www.baeldung.com/grpc-introduction)
+42
View File
@@ -0,0 +1,42 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung.beanvalidation</groupId>
<artifactId>beanvalidation</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>beanvalidation</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.2.Final</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.4</version>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,17 @@
package com.baeldung.beanvalidation.application;
import javax.validation.Validation;
import javax.validation.Validator;
import com.baeldung.beanvalidation.model.User;
public class Application {
public static void main( String[] args ) {
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
User user = new User();
user.setName("Mary");
user.setEmail("no-email");
user.setAge(36);
validator.validate(user).stream().forEach(violation -> System.out.println(violation.getMessage()));
}
}
@@ -0,0 +1,13 @@
package com.baeldung.beanvalidation.container;
import java.util.Optional;
import javax.validation.constraints.Positive;
public class IntegerContainer {
private Optional<@Positive(message = "Value must be a positive integer") Integer> container = Optional.empty();
public void addElement(int element) {
container = Optional.of(element);
}
}
@@ -0,0 +1,14 @@
package com.baeldung.beanvalidation.container;
import java.util.ArrayList;
import java.util.List;
import javax.validation.constraints.NotNull;
public class StringContainer {
private List<@NotNull String> container = new ArrayList<>();
public void addElement(String element) {
container.add(element);
}
}
@@ -0,0 +1,48 @@
package com.baeldung.beanvalidation.model;
import java.io.Serializable;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.Email;
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull(message = "Name cannot be null")
@Size(min = 2, max = 32, message = "Name must be between 2 and 32 characters")
private String name;
@Email(message = "Email must be a well-formed email address")
private String email;
@Min(value = 1, message = "Age must not be lesser than 1")
@Max(value = 99, message = "Age must not be greater than 99")
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
@@ -0,0 +1,8 @@
package com.baeldung.beanvalidation.service;
public interface EntityService {
public String toString();
public void processEntity();
}

Some files were not shown because too many files have changed in this diff Show More