Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
1c742b5f44
17
.project
17
.project
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>parent-modules</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>RemoteSystemsTempFiles</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.rse.ui.remoteSystemsTempNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,47 +1,47 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<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/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>cxf-introduction</artifactId>
|
<artifactId>cxf-introduction</artifactId>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>apache-cxf</artifactId>
|
<artifactId>apache-cxf</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
<cxf.version>3.1.6</cxf.version>
|
<cxf.version>3.1.6</cxf.version>
|
||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>exec-maven-plugin</artifactId>
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<mainClass>com.baeldung.cxf.introduction.Server</mainClass>
|
<mainClass>com.baeldung.cxf.introduction.Server</mainClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.19.1</version>
|
<version>2.19.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<excludes>
|
<excludes>
|
||||||
<exclude>**/StudentTest.java</exclude>
|
<exclude>**/StudentTest.java</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.cxf</groupId>
|
<groupId>org.apache.cxf</groupId>
|
||||||
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
||||||
<version>${cxf.version}</version>
|
<version>${cxf.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.cxf</groupId>
|
<groupId>org.apache.cxf</groupId>
|
||||||
<artifactId>cxf-rt-transports-http-jetty</artifactId>
|
<artifactId>cxf-rt-transports-http-jetty</artifactId>
|
||||||
<version>${cxf.version}</version>
|
<version>${cxf.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -0,0 +1 @@
|
||||||
|
target/
|
|
@ -0,0 +1,129 @@
|
||||||
|
<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/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>cxf-spring</artifactId>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>apache-cxf</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
||||||
|
<version>${cxf.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-transports-http-jetty</artifactId>
|
||||||
|
<version>${cxf.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-webmvc</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${surefire.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>StudentTest.java</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>integration</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.cargo</groupId>
|
||||||
|
<artifactId>cargo-maven2-plugin</artifactId>
|
||||||
|
<version>1.4.19</version>
|
||||||
|
<configuration>
|
||||||
|
<container>
|
||||||
|
<containerId>tomcat8x</containerId>
|
||||||
|
<type>embedded</type>
|
||||||
|
</container>
|
||||||
|
<configuration>
|
||||||
|
<properties>
|
||||||
|
<cargo.hostname>localhost</cargo.hostname>
|
||||||
|
<cargo.servlet.port>8081</cargo.servlet.port>
|
||||||
|
</properties>
|
||||||
|
</configuration>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-server</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>stop-server</id>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>stop</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${surefire.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>test</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>none</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<cxf.version>3.1.6</cxf.version>
|
||||||
|
<spring.version>4.3.1.RELEASE</spring.version>
|
||||||
|
<surefire.version>2.19.1</surefire.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.baeldung.cxf.spring;
|
||||||
|
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.ServletRegistration;
|
||||||
|
|
||||||
|
import org.apache.cxf.transport.servlet.CXFServlet;
|
||||||
|
import org.springframework.web.WebApplicationInitializer;
|
||||||
|
import org.springframework.web.context.ContextLoaderListener;
|
||||||
|
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||||
|
|
||||||
|
public class AppInitializer implements WebApplicationInitializer {
|
||||||
|
@Override
|
||||||
|
public void onStartup(ServletContext container) {
|
||||||
|
AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
|
||||||
|
context.register(ServiceConfiguration.class);
|
||||||
|
container.addListener(new ContextLoaderListener(context));
|
||||||
|
|
||||||
|
ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new CXFServlet());
|
||||||
|
dispatcher.addMapping("/services/*");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.baeldung.cxf.spring;
|
||||||
|
|
||||||
|
import javax.jws.WebService;
|
||||||
|
|
||||||
|
@WebService
|
||||||
|
public interface Baeldung {
|
||||||
|
String hello(String name);
|
||||||
|
|
||||||
|
String register(Student student);
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.baeldung.cxf.spring;
|
||||||
|
|
||||||
|
import javax.jws.WebService;
|
||||||
|
|
||||||
|
@WebService(endpointInterface = "com.baeldung.cxf.spring.Baeldung")
|
||||||
|
public class BaeldungImpl implements Baeldung {
|
||||||
|
private int counter;
|
||||||
|
|
||||||
|
public String hello(String name) {
|
||||||
|
return "Hello " + name + "!";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String register(Student student) {
|
||||||
|
counter++;
|
||||||
|
return student.getName() + " is registered student number " + counter;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.baeldung.cxf.spring;
|
||||||
|
|
||||||
|
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class ClientConfiguration {
|
||||||
|
@Bean(name = "client")
|
||||||
|
public Object generateProxy() {
|
||||||
|
return proxyFactoryBean().create();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public JaxWsProxyFactoryBean proxyFactoryBean() {
|
||||||
|
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
|
||||||
|
proxyFactory.setServiceClass(Baeldung.class);
|
||||||
|
proxyFactory.setAddress("http://localhost:8081/services/baeldung");
|
||||||
|
return proxyFactory;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.baeldung.cxf.spring;
|
||||||
|
|
||||||
|
import javax.xml.ws.Endpoint;
|
||||||
|
|
||||||
|
import org.apache.cxf.Bus;
|
||||||
|
import org.apache.cxf.bus.spring.SpringBus;
|
||||||
|
import org.apache.cxf.jaxws.EndpointImpl;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class ServiceConfiguration {
|
||||||
|
@Bean(name = Bus.DEFAULT_BUS_ID)
|
||||||
|
public SpringBus springBus() {
|
||||||
|
return new SpringBus();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Endpoint endpoint() {
|
||||||
|
EndpointImpl endpoint = new EndpointImpl(springBus(), new BaeldungImpl());
|
||||||
|
endpoint.publish("http://localhost:8081/services/baeldung");
|
||||||
|
return endpoint;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.baeldung.cxf.spring;
|
||||||
|
|
||||||
|
public class Student {
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
Student() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Student(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.baeldung.cxf.spring;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||||
|
|
||||||
|
public class StudentTest {
|
||||||
|
private ApplicationContext context = new AnnotationConfigApplicationContext(ClientConfiguration.class);
|
||||||
|
private Baeldung baeldungProxy = (Baeldung) context.getBean("client");
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenUsingHelloMethod_thenCorrect() {
|
||||||
|
String response = baeldungProxy.hello("John Doe");
|
||||||
|
assertEquals("Hello John Doe!", response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenUsingRegisterMethod_thenCorrect() {
|
||||||
|
Student student1 = new Student("Adam");
|
||||||
|
Student student2 = new Student("Eve");
|
||||||
|
String student1Response = baeldungProxy.register(student1);
|
||||||
|
String student2Response = baeldungProxy.register(student2);
|
||||||
|
|
||||||
|
assertEquals("Adam is registered student number 1", student1Response);
|
||||||
|
assertEquals("Eve is registered student number 2", student2Response);
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,7 @@
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>cxf-introduction</module>
|
<module>cxf-introduction</module>
|
||||||
|
<module>cxf-spring</module>
|
||||||
</modules>
|
</modules>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="lib" path="src/test/resources/jars/herold.jar"/>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
|
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.jsdt.core.javascriptValidator"/>
|
|
||||||
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
|
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
|
||||||
</launchConfiguration>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>apache-fop</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beansProjectDescription>
|
|
||||||
<version>1</version>
|
|
||||||
<pluginVersion><![CDATA[3.3.0.201307091516-RELEASE]]></pluginVersion>
|
|
||||||
<configSuffixes>
|
|
||||||
<configSuffix><![CDATA[xml]]></configSuffix>
|
|
||||||
</configSuffixes>
|
|
||||||
<enableImports><![CDATA[false]]></enableImports>
|
|
||||||
<configs>
|
|
||||||
<config>src/main/webapp/WEB-INF/api-servlet.xml</config>
|
|
||||||
</configs>
|
|
||||||
<configSets>
|
|
||||||
</configSets>
|
|
||||||
</beansProjectDescription>
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
<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/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>autovalue-tutorial</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<name>AutoValue</name>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.3</version>
|
||||||
|
<configuration>
|
||||||
|
<source>7</source>
|
||||||
|
<target>7</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.auto.value</groupId>
|
||||||
|
<artifactId>auto-value</artifactId>
|
||||||
|
<version>1.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.3</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.baeldung.autovalue;
|
||||||
|
|
||||||
|
import com.google.auto.value.AutoValue;
|
||||||
|
|
||||||
|
@AutoValue
|
||||||
|
public abstract class AutoValueMoney {
|
||||||
|
public abstract String getCurrency();
|
||||||
|
|
||||||
|
public abstract long getAmount();
|
||||||
|
|
||||||
|
public static AutoValueMoney create(String currency, long amount) {
|
||||||
|
return new AutoValue_AutoValueMoney(currency, amount);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.baeldung.autovalue;
|
||||||
|
|
||||||
|
import com.google.auto.value.AutoValue;
|
||||||
|
|
||||||
|
@AutoValue
|
||||||
|
public abstract class AutoValueMoneyWithBuilder {
|
||||||
|
public abstract String getCurrency();
|
||||||
|
|
||||||
|
public abstract long getAmount();
|
||||||
|
|
||||||
|
static Builder builder() {
|
||||||
|
return new AutoValue_AutoValueMoneyWithBuilder.Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoValue.Builder
|
||||||
|
abstract static class Builder {
|
||||||
|
abstract Builder setCurrency(String currency);
|
||||||
|
|
||||||
|
abstract Builder setAmount(long amount);
|
||||||
|
|
||||||
|
abstract AutoValueMoneyWithBuilder build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.baeldung.autovalue;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public final class Foo {
|
||||||
|
private final String text;
|
||||||
|
private final int number;
|
||||||
|
|
||||||
|
public Foo(String text, int number) {
|
||||||
|
this.text = text;
|
||||||
|
this.number = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumber() {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(text, number);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Foo [text=" + text + ", number=" + number + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
Foo other = (Foo) obj;
|
||||||
|
if (number != other.number)
|
||||||
|
return false;
|
||||||
|
if (text == null) {
|
||||||
|
if (other.text != null)
|
||||||
|
return false;
|
||||||
|
} else if (!text.equals(other.text))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.baeldung.autovalue;
|
||||||
|
public final class ImmutableMoney {
|
||||||
|
private final long amount;
|
||||||
|
private final String currency;
|
||||||
|
public ImmutableMoney(long amount, String currency) {
|
||||||
|
this.amount = amount;
|
||||||
|
this.currency = currency;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + (int) (amount ^ (amount >>> 32));
|
||||||
|
result = prime * result
|
||||||
|
+ ((currency == null) ? 0 : currency.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
ImmutableMoney other = (ImmutableMoney) obj;
|
||||||
|
if (amount != other.amount)
|
||||||
|
return false;
|
||||||
|
if (currency == null) {
|
||||||
|
if (other.currency != null)
|
||||||
|
return false;
|
||||||
|
} else if (!currency.equals(other.currency))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrency() {
|
||||||
|
return currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ImmutableMoney [amount=" + amount + ", currency=" + currency
|
||||||
|
+ "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.baeldung.autovalue;
|
||||||
|
|
||||||
|
public class MutableMoney {
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "MutableMoney [amount=" + amount + ", currency=" + currency
|
||||||
|
+ "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getAmount() {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(long amount) {
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrency() {
|
||||||
|
return currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrency(String currency) {
|
||||||
|
this.currency = currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
private long amount;
|
||||||
|
private String currency;
|
||||||
|
|
||||||
|
public MutableMoney(long amount, String currency) {
|
||||||
|
super();
|
||||||
|
this.amount = amount;
|
||||||
|
this.currency = currency;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.baeldung.autovalue;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class MoneyTest {
|
||||||
|
@Test
|
||||||
|
public void givenTwoSameValueMoneyObjects_whenEqualityTestFails_thenCorrect() {
|
||||||
|
MutableMoney m1 = new MutableMoney(10000, "USD");
|
||||||
|
MutableMoney m2 = new MutableMoney(10000, "USD");
|
||||||
|
assertFalse(m1.equals(m2));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenTwoSameValueMoneyValueObjects_whenEqualityTestPasses_thenCorrect() {
|
||||||
|
ImmutableMoney m1 = new ImmutableMoney(10000, "USD");
|
||||||
|
ImmutableMoney m2 = new ImmutableMoney(10000, "USD");
|
||||||
|
assertTrue(m1.equals(m2));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenValueTypeWithAutoValue_whenFieldsCorrectlySet_thenCorrect() {
|
||||||
|
AutoValueMoney m = AutoValueMoney.create("USD", 10000);
|
||||||
|
assertEquals(m.getAmount(), 10000);
|
||||||
|
assertEquals(m.getCurrency(), "USD");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void given2EqualValueTypesWithAutoValue_whenEqual_thenCorrect() {
|
||||||
|
AutoValueMoney m1 = AutoValueMoney.create("USD", 5000);
|
||||||
|
AutoValueMoney m2 = AutoValueMoney.create("USD", 5000);
|
||||||
|
assertTrue(m1.equals(m2));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void given2DifferentValueTypesWithAutoValue_whenNotEqual_thenCorrect() {
|
||||||
|
AutoValueMoney m1 = AutoValueMoney.create("GBP", 5000);
|
||||||
|
AutoValueMoney m2 = AutoValueMoney.create("USD", 5000);
|
||||||
|
assertFalse(m1.equals(m2));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void given2EqualValueTypesWithBuilder_whenEqual_thenCorrect() {
|
||||||
|
AutoValueMoneyWithBuilder m1 = AutoValueMoneyWithBuilder.builder().setAmount(5000).setCurrency("USD").build();
|
||||||
|
AutoValueMoneyWithBuilder m2 = AutoValueMoneyWithBuilder.builder().setAmount(5000).setCurrency("USD").build();
|
||||||
|
assertTrue(m1.equals(m2));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void given2DifferentValueTypesBuilder_whenNotEqual_thenCorrect() {
|
||||||
|
AutoValueMoneyWithBuilder m1 = AutoValueMoneyWithBuilder.builder().setAmount(5000).setCurrency("USD").build();
|
||||||
|
AutoValueMoneyWithBuilder m2 = AutoValueMoneyWithBuilder.builder().setAmount(5000).setCurrency("GBP").build();
|
||||||
|
assertFalse(m1.equals(m2));
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void givenValueTypeWithBuilder_whenFieldsCorrectlySet_thenCorrect() {
|
||||||
|
AutoValueMoneyWithBuilder m = AutoValueMoneyWithBuilder.builder().setAmount(5000).setCurrency("USD").build();
|
||||||
|
assertEquals(m.getAmount(), 5000);
|
||||||
|
assertEquals(m.getCurrency(), "USD");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>core-java8</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -3,9 +3,12 @@
|
||||||
## Core Java 8 Cookbooks and Examples
|
## Core Java 8 Cookbooks and Examples
|
||||||
|
|
||||||
### Relevant Articles:
|
### Relevant Articles:
|
||||||
// - [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda)
|
- [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda)
|
||||||
- [Java – Directory Size](http://www.baeldung.com/java-folder-size)
|
- [Java – Directory Size](http://www.baeldung.com/java-folder-size)
|
||||||
- [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources)
|
- [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources)
|
||||||
|
- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial)
|
||||||
|
- [Java 8 New Features](http://www.baeldung.com/java-8-new-features)
|
||||||
- [Lambda Expressions and Functional Interfaces: Tips and Best Practices](http://www.baeldung.com/java-8-lambda-expressions-tips)
|
- [Lambda Expressions and Functional Interfaces: Tips and Best Practices](http://www.baeldung.com/java-8-lambda-expressions-tips)
|
||||||
- [The Double Colon Operator in Java 8](http://www.baeldung.com/java-8-double-colon-operator)
|
- [The Double Colon Operator in Java 8](http://www.baeldung.com/java-8-double-colon-operator)
|
||||||
- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial)
|
- [Java 8 Streams Advanced](http://www.baeldung.com/java-8-streams)
|
||||||
|
- [Java 8 Collectors](http://www.baeldung.com/java-8-collectors)
|
|
@ -66,7 +66,8 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.assertj</groupId>
|
<groupId>org.assertj</groupId>
|
||||||
<artifactId>assertj-core</artifactId>
|
<artifactId>assertj-core</artifactId>
|
||||||
<version>3.4.1</version>
|
<version>3.5.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -0,0 +1,265 @@
|
||||||
|
package com.baeldung.collectors;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.DoubleSummaryStatistics;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.BinaryOperator;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
import java.util.stream.Collector;
|
||||||
|
|
||||||
|
import static com.google.common.collect.Sets.newHashSet;
|
||||||
|
import static java.util.stream.Collectors.averagingDouble;
|
||||||
|
import static java.util.stream.Collectors.collectingAndThen;
|
||||||
|
import static java.util.stream.Collectors.counting;
|
||||||
|
import static java.util.stream.Collectors.groupingBy;
|
||||||
|
import static java.util.stream.Collectors.joining;
|
||||||
|
import static java.util.stream.Collectors.maxBy;
|
||||||
|
import static java.util.stream.Collectors.partitioningBy;
|
||||||
|
import static java.util.stream.Collectors.summarizingDouble;
|
||||||
|
import static java.util.stream.Collectors.summingDouble;
|
||||||
|
import static java.util.stream.Collectors.toCollection;
|
||||||
|
import static java.util.stream.Collectors.toList;
|
||||||
|
import static java.util.stream.Collectors.toMap;
|
||||||
|
import static java.util.stream.Collectors.toSet;
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||||
|
|
||||||
|
public class Java8CollectorsTest {
|
||||||
|
|
||||||
|
private final List<String> givenList = Arrays.asList("a", "bb", "ccc", "dd");
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCollectingToList_shouldCollectToList() throws Exception {
|
||||||
|
final List<String> result = givenList.stream()
|
||||||
|
.collect(toList());
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.containsAll(givenList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCollectingToList_shouldCollectToSet() throws Exception {
|
||||||
|
final Set<String> result = givenList.stream()
|
||||||
|
.collect(toSet());
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.containsAll(givenList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCollectingToCollection_shouldCollectToCollection() throws Exception {
|
||||||
|
final List<String> result = givenList.stream()
|
||||||
|
.collect(toCollection(LinkedList::new));
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.containsAll(givenList)
|
||||||
|
.isInstanceOf(LinkedList.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCollectingToImmutableCollection_shouldThrowException() throws Exception {
|
||||||
|
assertThatThrownBy(() -> {
|
||||||
|
givenList.stream()
|
||||||
|
.collect(toCollection(ImmutableList::of));
|
||||||
|
}).isInstanceOf(UnsupportedOperationException.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCollectingToMap_shouldCollectToMap() throws Exception {
|
||||||
|
final Map<String, Integer> result = givenList.stream()
|
||||||
|
.collect(toMap(Function.identity(), String::length));
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.containsEntry("a", 1)
|
||||||
|
.containsEntry("bb", 2)
|
||||||
|
.containsEntry("ccc", 3)
|
||||||
|
.containsEntry("dd", 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCollectingToMap_shouldCollectToMapMerging() throws Exception {
|
||||||
|
final Map<String, Integer> result = givenList.stream()
|
||||||
|
.collect(toMap(Function.identity(), String::length, (i1, i2) -> i1));
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.containsEntry("a", 1)
|
||||||
|
.containsEntry("bb", 2)
|
||||||
|
.containsEntry("ccc", 3)
|
||||||
|
.containsEntry("dd", 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCollectingAndThen_shouldCollect() throws Exception {
|
||||||
|
final List<String> result = givenList.stream()
|
||||||
|
.collect(collectingAndThen(toList(), ImmutableList::copyOf));
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.containsAll(givenList)
|
||||||
|
.isInstanceOf(ImmutableList.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenJoining_shouldJoin() throws Exception {
|
||||||
|
final String result = givenList.stream()
|
||||||
|
.collect(joining());
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.isEqualTo("abbcccdd");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenJoiningWithSeparator_shouldJoinWithSeparator() throws Exception {
|
||||||
|
final String result = givenList.stream()
|
||||||
|
.collect(joining(" "));
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.isEqualTo("a bb ccc dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenJoiningWithSeparatorAndPrefixAndPostfix_shouldJoinWithSeparatorPrePost() throws Exception {
|
||||||
|
final String result = givenList.stream()
|
||||||
|
.collect(joining(" ", "PRE-", "-POST"));
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.isEqualTo("PRE-a bb ccc dd-POST");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenPartitioningBy_shouldPartition() throws Exception {
|
||||||
|
final Map<Boolean, List<String>> result = givenList.stream()
|
||||||
|
.collect(partitioningBy(s -> s.length() > 2));
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.containsKeys(true, false)
|
||||||
|
.satisfies(booleanListMap -> {
|
||||||
|
assertThat(booleanListMap.get(true))
|
||||||
|
.contains("ccc");
|
||||||
|
|
||||||
|
assertThat(booleanListMap.get(false))
|
||||||
|
.contains("a", "bb", "dd");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCounting_shouldCount() throws Exception {
|
||||||
|
final Long result = givenList.stream()
|
||||||
|
.collect(counting());
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.isEqualTo(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSummarizing_shouldSummarize() throws Exception {
|
||||||
|
final DoubleSummaryStatistics result = givenList.stream()
|
||||||
|
.collect(summarizingDouble(String::length));
|
||||||
|
|
||||||
|
assertThat(result.getAverage())
|
||||||
|
.isEqualTo(2);
|
||||||
|
assertThat(result.getCount())
|
||||||
|
.isEqualTo(4);
|
||||||
|
assertThat(result.getMax())
|
||||||
|
.isEqualTo(3);
|
||||||
|
assertThat(result.getMin())
|
||||||
|
.isEqualTo(1);
|
||||||
|
assertThat(result.getSum())
|
||||||
|
.isEqualTo(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenAveraging_shouldAverage() throws Exception {
|
||||||
|
final Double result = givenList.stream()
|
||||||
|
.collect(averagingDouble(String::length));
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.isEqualTo(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenSumming_shouldSum() throws Exception {
|
||||||
|
final Double result = givenList.stream()
|
||||||
|
.collect(summingDouble(String::length));
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.isEqualTo(8);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenMaxingBy_shouldMaxBy() throws Exception {
|
||||||
|
final Optional<String> result = givenList.stream()
|
||||||
|
.collect(maxBy(Comparator.naturalOrder()));
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.isPresent()
|
||||||
|
.hasValue("dd");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenGroupingBy_shouldGroupBy() throws Exception {
|
||||||
|
final Map<Integer, Set<String>> result = givenList.stream()
|
||||||
|
.collect(groupingBy(String::length, toSet()));
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.containsEntry(1, newHashSet("a"))
|
||||||
|
.containsEntry(2, newHashSet("bb", "dd"))
|
||||||
|
.containsEntry(3, newHashSet("ccc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCreatingCustomCollector_shouldCollect() throws Exception {
|
||||||
|
final ImmutableSet<String> result = givenList.stream()
|
||||||
|
.collect(toImmutableSet());
|
||||||
|
|
||||||
|
assertThat(result)
|
||||||
|
.isInstanceOf(ImmutableSet.class)
|
||||||
|
.contains("a", "bb", "ccc", "dd");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> ImmutableSetCollector<T> toImmutableSet() {
|
||||||
|
return new ImmutableSetCollector<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ImmutableSetCollector<T> implements Collector<T, ImmutableSet.Builder<T>, ImmutableSet<T>> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Supplier<ImmutableSet.Builder<T>> supplier() {
|
||||||
|
return ImmutableSet::builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BiConsumer<ImmutableSet.Builder<T>, T> accumulator() {
|
||||||
|
return ImmutableSet.Builder::add;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BinaryOperator<ImmutableSet.Builder<T>> combiner() {
|
||||||
|
return (left, right) -> left.addAll(right.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Function<ImmutableSet.Builder<T>, ImmutableSet<T>> finisher() {
|
||||||
|
return ImmutableSet.Builder::build;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Characteristics> characteristics() {
|
||||||
|
return Sets.immutableEnumSet(Characteristics.UNORDERED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="owner.project.facets" value="java"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
|
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.jsdt.core.javascriptValidator"/>
|
|
||||||
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
|
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
|
||||||
</launchConfiguration>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>core-java</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" path="src/main/webapp"/>
|
|
||||||
<classpathentry kind="output" path=""/>
|
|
||||||
</classpath>
|
|
|
@ -1,100 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
|
||||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
|
@ -1,55 +0,0 @@
|
||||||
#Sat Jan 21 23:04:06 EET 2012
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
|
|
||||||
sp_cleanup.add_default_serial_version_id=true
|
|
||||||
sp_cleanup.add_generated_serial_version_id=false
|
|
||||||
sp_cleanup.add_missing_annotations=true
|
|
||||||
sp_cleanup.add_missing_deprecated_annotations=true
|
|
||||||
sp_cleanup.add_missing_methods=false
|
|
||||||
sp_cleanup.add_missing_nls_tags=false
|
|
||||||
sp_cleanup.add_missing_override_annotations=true
|
|
||||||
sp_cleanup.add_missing_override_annotations_interface_methods=true
|
|
||||||
sp_cleanup.add_serial_version_id=false
|
|
||||||
sp_cleanup.always_use_blocks=true
|
|
||||||
sp_cleanup.always_use_parentheses_in_expressions=true
|
|
||||||
sp_cleanup.always_use_this_for_non_static_field_access=false
|
|
||||||
sp_cleanup.always_use_this_for_non_static_method_access=false
|
|
||||||
sp_cleanup.convert_to_enhanced_for_loop=true
|
|
||||||
sp_cleanup.correct_indentation=true
|
|
||||||
sp_cleanup.format_source_code=true
|
|
||||||
sp_cleanup.format_source_code_changes_only=true
|
|
||||||
sp_cleanup.make_local_variable_final=true
|
|
||||||
sp_cleanup.make_parameters_final=true
|
|
||||||
sp_cleanup.make_private_fields_final=false
|
|
||||||
sp_cleanup.make_type_abstract_if_missing_method=false
|
|
||||||
sp_cleanup.make_variable_declarations_final=true
|
|
||||||
sp_cleanup.never_use_blocks=false
|
|
||||||
sp_cleanup.never_use_parentheses_in_expressions=false
|
|
||||||
sp_cleanup.on_save_use_additional_actions=true
|
|
||||||
sp_cleanup.organize_imports=true
|
|
||||||
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
|
|
||||||
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
|
|
||||||
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
|
|
||||||
sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
|
|
||||||
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
|
|
||||||
sp_cleanup.remove_private_constructors=true
|
|
||||||
sp_cleanup.remove_trailing_whitespaces=true
|
|
||||||
sp_cleanup.remove_trailing_whitespaces_all=true
|
|
||||||
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
|
|
||||||
sp_cleanup.remove_unnecessary_casts=true
|
|
||||||
sp_cleanup.remove_unnecessary_nls_tags=false
|
|
||||||
sp_cleanup.remove_unused_imports=true
|
|
||||||
sp_cleanup.remove_unused_local_variables=false
|
|
||||||
sp_cleanup.remove_unused_private_fields=true
|
|
||||||
sp_cleanup.remove_unused_private_members=false
|
|
||||||
sp_cleanup.remove_unused_private_methods=true
|
|
||||||
sp_cleanup.remove_unused_private_types=true
|
|
||||||
sp_cleanup.sort_members=false
|
|
||||||
sp_cleanup.sort_members_all=false
|
|
||||||
sp_cleanup.use_blocks=false
|
|
||||||
sp_cleanup.use_blocks_only_for_return_and_throw=false
|
|
||||||
sp_cleanup.use_parentheses_in_expressions=false
|
|
||||||
sp_cleanup.use_this_for_non_static_field_access=true
|
|
||||||
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
|
|
||||||
sp_cleanup.use_this_for_non_static_method_access=true
|
|
||||||
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
|
|
|
@ -1,4 +0,0 @@
|
||||||
activeProfiles=
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
resolveWorkspaceProjects=true
|
|
||||||
version=1
|
|
|
@ -1,2 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
|
||||||
<wb-module deploy-name="spring-rest">
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
|
||||||
<property name="context-root" value="spring-rest"/>
|
|
||||||
<property name="java-output-path" value="/spring-rest/target/classes"/>
|
|
||||||
</wb-module>
|
|
||||||
</project-modules>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<faceted-project>
|
|
||||||
<installed facet="java" version="1.8"/>
|
|
||||||
</faceted-project>
|
|
|
@ -1 +0,0 @@
|
||||||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
|
@ -1 +0,0 @@
|
||||||
Window
|
|
|
@ -1,14 +0,0 @@
|
||||||
DELEGATES_PREFERENCE=delegateValidatorList
|
|
||||||
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;
|
|
||||||
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;
|
|
||||||
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.303.v201202090300
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
override=true
|
|
||||||
suspend=false
|
|
||||||
vals/org.eclipse.jst.jsf.ui.JSFAppConfigValidator/global=FF01
|
|
||||||
vals/org.eclipse.jst.jsp.core.JSPBatchValidator/global=FF01
|
|
||||||
vals/org.eclipse.jst.jsp.core.JSPContentValidator/global=FF01
|
|
||||||
vals/org.eclipse.jst.jsp.core.TLDValidator/global=FF01
|
|
||||||
vals/org.eclipse.wst.dtd.core.dtdDTDValidator/global=FF01
|
|
||||||
vals/org.eclipse.wst.jsdt.web.core.JsBatchValidator/global=TF02
|
|
||||||
vf.version=3
|
|
|
@ -1,2 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.wst.ws.service.policy.projectEnabled=false
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beansProjectDescription>
|
|
||||||
<version>1</version>
|
|
||||||
<pluginVersion><![CDATA[3.3.0.201307091516-RELEASE]]></pluginVersion>
|
|
||||||
<configSuffixes>
|
|
||||||
<configSuffix><![CDATA[xml]]></configSuffix>
|
|
||||||
</configSuffixes>
|
|
||||||
<enableImports><![CDATA[false]]></enableImports>
|
|
||||||
<configs>
|
|
||||||
<config>src/main/webapp/WEB-INF/api-servlet.xml</config>
|
|
||||||
</configs>
|
|
||||||
<configSets>
|
|
||||||
</configSets>
|
|
||||||
</beansProjectDescription>
|
|
|
@ -101,6 +101,22 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.assertj</groupId>
|
||||||
|
<artifactId>assertj-core</artifactId>
|
||||||
|
<version>${assertj.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.testng</groupId>
|
||||||
|
<artifactId>testng</artifactId>
|
||||||
|
<version>${testng.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
|
@ -169,6 +185,8 @@
|
||||||
<org.hamcrest.version>1.3</org.hamcrest.version>
|
<org.hamcrest.version>1.3</org.hamcrest.version>
|
||||||
<junit.version>4.12</junit.version>
|
<junit.version>4.12</junit.version>
|
||||||
<mockito.version>1.10.19</mockito.version>
|
<mockito.version>1.10.19</mockito.version>
|
||||||
|
<testng.version>6.8</testng.version>
|
||||||
|
<assertj.version>3.5.1</assertj.version>
|
||||||
|
|
||||||
<httpcore.version>4.4.1</httpcore.version>
|
<httpcore.version>4.4.1</httpcore.version>
|
||||||
<httpclient.version>4.5</httpclient.version>
|
<httpclient.version>4.5</httpclient.version>
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
package org.baeldung.java.arrays;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class ArraysJoinAndSplitJUnitTest {
|
||||||
|
|
||||||
|
private final String[] sauces = {"Marinara", "Olive Oil"};
|
||||||
|
private final String[] cheeses = {"Mozzarella", "Feta", "Parmesan"};
|
||||||
|
private final String[] vegetables = {"Olives", "Spinach", "Green Peppers"};
|
||||||
|
|
||||||
|
private final String[] customers = {"Jay", "Harry", "Ronnie", "Gary", "Ross"};
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenThreeStringArrays_whenJoiningIntoOneStringArray_shouldSucceed() {
|
||||||
|
String[] toppings = new String[sauces.length + cheeses.length + vegetables.length];
|
||||||
|
|
||||||
|
System.arraycopy(sauces, 0, toppings, 0, sauces.length);
|
||||||
|
int AddedSoFar = sauces.length;
|
||||||
|
|
||||||
|
System.arraycopy(cheeses, 0, toppings, AddedSoFar, cheeses.length);
|
||||||
|
AddedSoFar += cheeses.length;
|
||||||
|
|
||||||
|
System.arraycopy(vegetables, 0, toppings, AddedSoFar, vegetables.length);
|
||||||
|
|
||||||
|
Assert.assertArrayEquals(toppings,
|
||||||
|
new String[]{"Marinara", "Olive Oil", "Mozzarella", "Feta",
|
||||||
|
"Parmesan", "Olives", "Spinach", "Green Peppers"});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenOneStringArray_whenSplittingInHalfTwoStringArrays_shouldSucceed() {
|
||||||
|
int ordersHalved = (customers.length / 2) + (customers.length % 2);
|
||||||
|
|
||||||
|
String[] driverOne = Arrays.copyOf(customers, ordersHalved);
|
||||||
|
String[] driverTwo = Arrays.copyOfRange(customers, ordersHalved, customers.length);
|
||||||
|
|
||||||
|
Assert.assertArrayEquals(driverOne, new String[]{"Jay", "Harry", "Ronnie"});
|
||||||
|
Assert.assertArrayEquals(driverTwo, new String[]{"Gary", "Ross"});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package org.baeldung.java.collections;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class CollectionsJoinAndSplitJUnitTest {
|
||||||
|
|
||||||
|
private ArrayList<String> sauces = new ArrayList<>();
|
||||||
|
private ArrayList<String> cheeses = new ArrayList<>();
|
||||||
|
private ArrayList<String> vegetables = new ArrayList<>();
|
||||||
|
|
||||||
|
private ArrayList<ArrayList<String>> ingredients = new ArrayList<>();
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void init() {
|
||||||
|
sauces.add("Olive Oil");
|
||||||
|
sauces.add("Marinara");
|
||||||
|
|
||||||
|
cheeses.add("Mozzarella");
|
||||||
|
cheeses.add("Feta");
|
||||||
|
cheeses.add("Parmesan");
|
||||||
|
|
||||||
|
vegetables.add("Olives");
|
||||||
|
vegetables.add("Spinach");
|
||||||
|
vegetables.add("Green Peppers");
|
||||||
|
|
||||||
|
ingredients.add(sauces);
|
||||||
|
ingredients.add(cheeses);
|
||||||
|
ingredients.add(vegetables);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenThreeArrayLists_whenJoiningIntoOneArrayList_shouldSucceed() {
|
||||||
|
ArrayList<ArrayList<String>> toppings = new ArrayList<>();
|
||||||
|
|
||||||
|
toppings.add(sauces);
|
||||||
|
toppings.add(cheeses);
|
||||||
|
toppings.add(vegetables);
|
||||||
|
|
||||||
|
Assert.assertTrue(toppings.size() == 3);
|
||||||
|
Assert.assertTrue(toppings.contains(sauces));
|
||||||
|
Assert.assertTrue(toppings.contains(cheeses));
|
||||||
|
Assert.assertTrue(toppings.contains(vegetables));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenOneArrayList_whenSplittingIntoTwoArrayLists_shouldSucceed() {
|
||||||
|
|
||||||
|
ArrayList<ArrayList<String>> removedToppings = new ArrayList<>();
|
||||||
|
removedToppings.add(ingredients.remove(ingredients.indexOf(vegetables)));
|
||||||
|
|
||||||
|
Assert.assertTrue(removedToppings.contains(vegetables));
|
||||||
|
Assert.assertTrue(removedToppings.size() == 1);
|
||||||
|
Assert.assertTrue(ingredients.size() == 2);
|
||||||
|
Assert.assertTrue(ingredients.contains(sauces));
|
||||||
|
Assert.assertTrue(ingredients.contains(cheeses));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.baeldung.java.lists;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
public class ListAssertJTest {
|
||||||
|
|
||||||
|
private final List<String> list1 = Arrays.asList("1", "2", "3", "4");
|
||||||
|
private final List<String> list2 = Arrays.asList("1", "2", "3", "4");
|
||||||
|
private final List<String> list3 = Arrays.asList("1", "2", "4", "3");
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenTestingForEquality_ShouldBeEqual() throws Exception {
|
||||||
|
assertThat(list1)
|
||||||
|
.isEqualTo(list2)
|
||||||
|
.isNotEqualTo(list3);
|
||||||
|
|
||||||
|
assertThat(list1.equals(list2)).isTrue();
|
||||||
|
assertThat(list1.equals(list3)).isFalse();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.baeldung.java.lists;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ListJUnitTest {
|
||||||
|
|
||||||
|
private final List<String> list1 = Arrays.asList("1", "2", "3", "4");
|
||||||
|
private final List<String> list2 = Arrays.asList("1", "2", "3", "4");
|
||||||
|
private final List<String> list3 = Arrays.asList("1", "2", "4", "3");
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenTestingForEquality_ShouldBeEqual() throws Exception {
|
||||||
|
Assert.assertEquals(list1, list2);
|
||||||
|
Assert.assertNotSame(list1, list2);
|
||||||
|
Assert.assertNotEquals(list1, list3);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.baeldung.java.lists;
|
||||||
|
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ListTestNGTest {
|
||||||
|
|
||||||
|
private final List<String> list1 = Arrays.asList("1", "2", "3", "4");
|
||||||
|
private final List<String> list2 = Arrays.asList("1", "2", "3", "4");
|
||||||
|
private final List<String> list3 = Arrays.asList("1", "2", "4", "3");
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenTestingForEquality_ShouldBeEqual() throws Exception {
|
||||||
|
Assert.assertEquals(list1, list2);
|
||||||
|
Assert.assertNotSame(list1, list2);
|
||||||
|
Assert.assertNotEquals(list1, list3);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,31 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
|
@ -1,23 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>couchbase-intro</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beansProjectDescription>
|
|
||||||
<version>1</version>
|
|
||||||
<pluginVersion><![CDATA[3.7.3.201602250914-RELEASE]]></pluginVersion>
|
|
||||||
<configSuffixes>
|
|
||||||
<configSuffix><![CDATA[xml]]></configSuffix>
|
|
||||||
</configSuffixes>
|
|
||||||
<enableImports><![CDATA[false]]></enableImports>
|
|
||||||
<configs>
|
|
||||||
</configs>
|
|
||||||
<autoconfigs>
|
|
||||||
</autoconfigs>
|
|
||||||
<configSets>
|
|
||||||
</configSets>
|
|
||||||
</beansProjectDescription>
|
|
|
@ -1,6 +1,5 @@
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -9,7 +8,7 @@
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<name>Resource vs Inject vs Autowired</name>
|
<name>dependency-injection</name>
|
||||||
<description>Accompanying the demonstration of the use of the annotations related to injection mechanisms, namely
|
<description>Accompanying the demonstration of the use of the annotations related to injection mechanisms, namely
|
||||||
Resource, Inject, and Autowired
|
Resource, Inject, and Autowired
|
||||||
</description>
|
</description>
|
||||||
|
@ -54,6 +53,7 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
@ -71,13 +71,29 @@
|
||||||
</includes>
|
</includes>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>${maven-war-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven-war-plugin.version>2.6</maven-war-plugin.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>java.net</id>
|
<id>java.net</id>
|
||||||
<url>https://maven.java.net/content/repositories/releases/</url>
|
<url>https://maven.java.net/content/repositories/releases/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
<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/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>dozer</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
|
||||||
|
<name>dozer</name>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.3</version>
|
||||||
|
<configuration>
|
||||||
|
<source>7</source>
|
||||||
|
<target>7</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>1.7.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>jcl-over-slf4j</artifactId>
|
||||||
|
<version>1.7.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sf.dozer</groupId>
|
||||||
|
<artifactId>dozer</artifactId>
|
||||||
|
<version>5.5.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.3</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
public class Dest {
|
||||||
|
private String name;
|
||||||
|
private int age;
|
||||||
|
|
||||||
|
public Dest() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dest(String name, int age) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(int age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
public class Dest2 {
|
||||||
|
private int id;
|
||||||
|
private int points;
|
||||||
|
|
||||||
|
public Dest2() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dest2(int id, int points) {
|
||||||
|
super();
|
||||||
|
this.id = id;
|
||||||
|
this.points = points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPoints() {
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoints(int points) {
|
||||||
|
this.points = points;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Dest2 [id=" + id + ", points=" + points + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.dozer.CustomConverter;
|
||||||
|
import org.dozer.MappingException;
|
||||||
|
|
||||||
|
public class MyCustomConvertor implements CustomConverter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object convert(Object dest, Object source, Class<?> arg2, Class<?> arg3) {
|
||||||
|
if (source == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (source instanceof Personne3) {
|
||||||
|
Personne3 person = (Personne3) source;
|
||||||
|
Date date = new Date(person.getDtob());
|
||||||
|
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||||
|
String isoDate = format.format(date);
|
||||||
|
return new Person3(person.getName(), isoDate);
|
||||||
|
|
||||||
|
} else if (source instanceof Person3) {
|
||||||
|
Person3 person = (Person3) source;
|
||||||
|
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||||
|
Date date = null;
|
||||||
|
try {
|
||||||
|
date = format.parse(person.getDtob());
|
||||||
|
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new MappingException("Converter MyCustomConvertor " + "used incorrectly:" + e.getMessage());
|
||||||
|
}
|
||||||
|
long timestamp = date.getTime();
|
||||||
|
return new Personne3(person.getName(), timestamp);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw new MappingException("Converter MyCustomConvertor " + "used incorrectly. Arguments passed in were:" + dest + " and " + source);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
public class Person {
|
||||||
|
private String name;
|
||||||
|
private String nickname;
|
||||||
|
private int age;
|
||||||
|
|
||||||
|
public Person() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Person(String name, String nickname, int age) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.nickname = nickname;
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNickname() {
|
||||||
|
return nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNickname(String nickname) {
|
||||||
|
this.nickname = nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(int age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
public class Person2 {
|
||||||
|
private String name;
|
||||||
|
private String nickname;
|
||||||
|
private int age;
|
||||||
|
|
||||||
|
public Person2() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Person2(String name, String nickname, int age) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.nickname = nickname;
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNickname() {
|
||||||
|
return nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNickname(String nickname) {
|
||||||
|
this.nickname = nickname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(int age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
public class Person3 {
|
||||||
|
private String name;
|
||||||
|
private String dtob;
|
||||||
|
|
||||||
|
public Person3() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Person3(String name, String dtob) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.dtob = dtob;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDtob() {
|
||||||
|
return dtob;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDtob(String dtob) {
|
||||||
|
this.dtob = dtob;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Person3 [name=" + name + ", dtob=" + dtob + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
public class Personne {
|
||||||
|
private String nom;
|
||||||
|
private String surnom;
|
||||||
|
private int age;
|
||||||
|
|
||||||
|
public Personne() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Personne(String nom, String surnom, int age) {
|
||||||
|
super();
|
||||||
|
this.nom = nom;
|
||||||
|
this.surnom = surnom;
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNom() {
|
||||||
|
return nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNom(String nom) {
|
||||||
|
this.nom = nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurnom() {
|
||||||
|
return surnom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurnom(String surnom) {
|
||||||
|
this.surnom = surnom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(int age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
import org.dozer.Mapping;
|
||||||
|
|
||||||
|
public class Personne2 {
|
||||||
|
private String nom;
|
||||||
|
private String surnom;
|
||||||
|
private int age;
|
||||||
|
|
||||||
|
public Personne2() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Personne2(String nom, String surnom, int age) {
|
||||||
|
super();
|
||||||
|
this.nom = nom;
|
||||||
|
this.surnom = surnom;
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mapping("name")
|
||||||
|
public String getNom() {
|
||||||
|
return nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mapping("nickname")
|
||||||
|
public String getSurnom() {
|
||||||
|
return surnom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNom(String nom) {
|
||||||
|
this.nom = nom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurnom(String surnom) {
|
||||||
|
this.surnom = surnom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(int age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
public class Personne3 {
|
||||||
|
private String name;
|
||||||
|
private long dtob;
|
||||||
|
|
||||||
|
public Personne3() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Personne3(String name, long dtob) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.dtob = dtob;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDtob() {
|
||||||
|
return dtob;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDtob(long dtob) {
|
||||||
|
this.dtob = dtob;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Personne3 [name=" + name + ", dtob=" + dtob + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
public class Source {
|
||||||
|
private String name;
|
||||||
|
private int age;
|
||||||
|
|
||||||
|
public Source() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Source(String name, int age) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAge() {
|
||||||
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAge(int age) {
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
public class Source2 {
|
||||||
|
private String id;
|
||||||
|
private double points;
|
||||||
|
|
||||||
|
public Source2() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Source2(String id, double points) {
|
||||||
|
super();
|
||||||
|
this.id = id;
|
||||||
|
this.points = points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPoints() {
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoints(double points) {
|
||||||
|
this.points = points;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Source2 [id=" + id + ", points=" + points + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,199 @@
|
||||||
|
package com.baeldung.dozer;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.dozer.DozerBeanMapper;
|
||||||
|
import org.dozer.loader.api.BeanMappingBuilder;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class DozerTest {
|
||||||
|
private final long GMT_DIFFERENCE = 46800000;
|
||||||
|
|
||||||
|
DozerBeanMapper mapper;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void before() throws Exception {
|
||||||
|
mapper = new DozerBeanMapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
BeanMappingBuilder builder = new BeanMappingBuilder() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
mapping(Person.class, Personne.class).fields("name", "nom").fields("nickname", "surnom");
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
BeanMappingBuilder builderMinusAge = new BeanMappingBuilder() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
mapping(Person.class, Personne.class).fields("name", "nom").fields("nickname", "surnom").exclude("age");
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenApiMapper_whenMaps_thenCorrect() {
|
||||||
|
mapper.addMapping(builder);
|
||||||
|
|
||||||
|
Personne frenchAppPerson = new Personne("Sylvester Stallone", "Rambo", 70);
|
||||||
|
Person englishAppPerson = mapper.map(frenchAppPerson, Person.class);
|
||||||
|
|
||||||
|
assertEquals(englishAppPerson.getName(), frenchAppPerson.getNom());
|
||||||
|
assertEquals(englishAppPerson.getNickname(), frenchAppPerson.getSurnom());
|
||||||
|
assertEquals(englishAppPerson.getAge(), frenchAppPerson.getAge());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenApiMapper_whenMapsOnlySpecifiedFields_thenCorrect() {
|
||||||
|
mapper.addMapping(builderMinusAge);
|
||||||
|
|
||||||
|
Person englishAppPerson = new Person("Sylvester Stallone", "Rambo", 70);
|
||||||
|
Personne frenchAppPerson = mapper.map(englishAppPerson, Personne.class);
|
||||||
|
|
||||||
|
assertEquals(frenchAppPerson.getNom(), englishAppPerson.getName());
|
||||||
|
assertEquals(frenchAppPerson.getSurnom(), englishAppPerson.getNickname());
|
||||||
|
assertEquals(frenchAppPerson.getAge(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenApiMapper_whenMapsBidirectionally_thenCorrect() {
|
||||||
|
mapper.addMapping(builder);
|
||||||
|
|
||||||
|
Person englishAppPerson = new Person("Sylvester Stallone", "Rambo", 70);
|
||||||
|
Personne frenchAppPerson = mapper.map(englishAppPerson, Personne.class);
|
||||||
|
|
||||||
|
assertEquals(frenchAppPerson.getNom(), englishAppPerson.getName());
|
||||||
|
assertEquals(frenchAppPerson.getSurnom(), englishAppPerson.getNickname());
|
||||||
|
assertEquals(frenchAppPerson.getAge(), englishAppPerson.getAge());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenSourceObjectAndDestClass_whenMapsSameNameFieldsCorrectly_thenCorrect() {
|
||||||
|
Source source = new Source("Baeldung", 10);
|
||||||
|
Dest dest = mapper.map(source, Dest.class);
|
||||||
|
assertEquals(dest.getName(), "Baeldung");
|
||||||
|
assertEquals(dest.getAge(), 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenSourceObjectAndDestObject_whenMapsSameNameFieldsCorrectly_thenCorrect() {
|
||||||
|
Source source = new Source("Baeldung", 10);
|
||||||
|
Dest dest = new Dest();
|
||||||
|
mapper.map(source, dest);
|
||||||
|
assertEquals(dest.getName(), "Baeldung");
|
||||||
|
assertEquals(dest.getAge(), 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenSourceAndDestWithDifferentFieldTypes_whenMapsAndAutoConverts_thenCorrect() {
|
||||||
|
Source2 source = new Source2("320", 15.2);
|
||||||
|
Dest2 dest = mapper.map(source, Dest2.class);
|
||||||
|
assertEquals(dest.getId(), 320);
|
||||||
|
assertEquals(dest.getPoints(), 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenSrcAndDestWithDifferentFieldNamesWithCustomMapper_whenMaps_thenCorrect() {
|
||||||
|
configureMapper("dozer_mapping.xml");
|
||||||
|
|
||||||
|
Personne frenchAppPerson = new Personne("Sylvester Stallone", "Rambo", 70);
|
||||||
|
Person englishAppPerson = mapper.map(frenchAppPerson, Person.class);
|
||||||
|
|
||||||
|
assertEquals(englishAppPerson.getName(), frenchAppPerson.getNom());
|
||||||
|
assertEquals(englishAppPerson.getNickname(), frenchAppPerson.getSurnom());
|
||||||
|
assertEquals(englishAppPerson.getAge(), frenchAppPerson.getAge());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenSrcAndDestWithDifferentFieldNamesWithCustomMapper_whenMapsBidirectionally_thenCorrect() {
|
||||||
|
configureMapper("dozer_mapping.xml");
|
||||||
|
|
||||||
|
Person englishAppPerson = new Person("Dwayne Johnson", "The Rock", 44);
|
||||||
|
Personne frenchAppPerson = mapper.map(englishAppPerson, Personne.class);
|
||||||
|
|
||||||
|
assertEquals(frenchAppPerson.getNom(), englishAppPerson.getName());
|
||||||
|
assertEquals(frenchAppPerson.getSurnom(), englishAppPerson.getNickname());
|
||||||
|
assertEquals(frenchAppPerson.getAge(), englishAppPerson.getAge());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Ignore("place dozer_mapping.xml at a location of your choice and copy/paste the path after file: in configureMapper method")
|
||||||
|
@Test
|
||||||
|
public void givenMappingFileOutsideClasspath_whenMaps_thenCorrect() {
|
||||||
|
configureMapper("file:e:/dozer_mapping.xml");
|
||||||
|
|
||||||
|
Person englishAppPerson = new Person("Marshall Bruce Mathers III", "Eminem", 43);
|
||||||
|
Personne frenchAppPerson = mapper.map(englishAppPerson, Personne.class);
|
||||||
|
|
||||||
|
assertEquals(frenchAppPerson.getNom(), englishAppPerson.getName());
|
||||||
|
assertEquals(frenchAppPerson.getSurnom(), englishAppPerson.getNickname());
|
||||||
|
assertEquals(frenchAppPerson.getAge(), englishAppPerson.getAge());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenSrcAndDest_whenMapsOnlySpecifiedFields_thenCorrect() {
|
||||||
|
configureMapper("dozer_mapping2.xml");
|
||||||
|
|
||||||
|
Person englishAppPerson = new Person("Shawn Corey Carter", "Jay Z", 46);
|
||||||
|
Personne frenchAppPerson = mapper.map(englishAppPerson, Personne.class);
|
||||||
|
|
||||||
|
assertEquals(frenchAppPerson.getNom(), englishAppPerson.getName());
|
||||||
|
assertEquals(frenchAppPerson.getSurnom(), englishAppPerson.getNickname());
|
||||||
|
assertEquals(frenchAppPerson.getAge(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenAnnotatedSrcFields_whenMapsToRightDestField_thenCorrect() {
|
||||||
|
Person2 englishAppPerson = new Person2("Jean-Claude Van Damme", "JCVD", 55);
|
||||||
|
Personne2 frenchAppPerson = mapper.map(englishAppPerson, Personne2.class);
|
||||||
|
assertEquals(frenchAppPerson.getNom(), englishAppPerson.getName());
|
||||||
|
assertEquals(frenchAppPerson.getSurnom(), englishAppPerson.getNickname());
|
||||||
|
assertEquals(frenchAppPerson.getAge(), englishAppPerson.getAge());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenAnnotatedSrcFields_whenMapsToRightDestFieldBidirectionally_thenCorrect() {
|
||||||
|
Personne2 frenchAppPerson = new Personne2("Jason Statham", "transporter", 49);
|
||||||
|
Person2 englishAppPerson = mapper.map(frenchAppPerson, Person2.class);
|
||||||
|
assertEquals(englishAppPerson.getName(), frenchAppPerson.getNom());
|
||||||
|
assertEquals(englishAppPerson.getNickname(), frenchAppPerson.getSurnom());
|
||||||
|
assertEquals(englishAppPerson.getAge(), frenchAppPerson.getAge());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenSrcAndDestWithDifferentFieldTypes_whenAbleToCustomConvert_thenCorrect() {
|
||||||
|
configureMapper("dozer_custom_convertor.xml");
|
||||||
|
|
||||||
|
String dateTime = "2007-06-26T21:22:39Z";
|
||||||
|
long timestamp = new Long("1182882159000");
|
||||||
|
|
||||||
|
Person3 person = new Person3("Rich", dateTime);
|
||||||
|
Personne3 person0 = mapper.map(person, Personne3.class);
|
||||||
|
|
||||||
|
long timestampToTest = person0.getDtob();
|
||||||
|
assertTrue(timestampToTest == timestamp || timestampToTest >= timestamp - GMT_DIFFERENCE || timestampToTest <= timestamp + GMT_DIFFERENCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenSrcAndDestWithDifferentFieldTypes_whenAbleToCustomConvertBidirectionally_thenCorrect() {
|
||||||
|
long timestamp = new Long("1182882159000");
|
||||||
|
Personne3 person = new Personne3("Rich", timestamp);
|
||||||
|
configureMapper("dozer_custom_convertor.xml");
|
||||||
|
|
||||||
|
Person3 person0 = mapper.map(person, Person3.class);
|
||||||
|
String timestampTest = person0.getDtob();
|
||||||
|
|
||||||
|
assertTrue(timestampTest.charAt(10) == 'T' && timestampTest.charAt(19) == 'Z');
|
||||||
|
}
|
||||||
|
|
||||||
|
public void configureMapper(String... mappingFileUrls) {
|
||||||
|
mapper.setMappingFiles(Arrays.asList(mappingFileUrls));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<mappings xmlns="http://dozer.sourceforge.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://dozer.sourceforge.net
|
||||||
|
http://dozer.sourceforge.net/schema/beanmapping.xsd">
|
||||||
|
<configuration>
|
||||||
|
<custom-converters>
|
||||||
|
<converter type="com.baeldung.dozer.MyCustomConvertor">
|
||||||
|
<class-a>com.baeldung.dozer.Personne3</class-a>
|
||||||
|
<class-b>com.baeldung.dozer.Person3</class-b>
|
||||||
|
</converter>
|
||||||
|
</custom-converters>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
</mappings>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<mappings xmlns="http://dozer.sourceforge.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://dozer.sourceforge.net
|
||||||
|
http://dozer.sourceforge.net/schema/beanmapping.xsd">
|
||||||
|
<mapping>
|
||||||
|
<class-a>com.baeldung.dozer.Personne</class-a>
|
||||||
|
<class-b>com.baeldung.dozer.Person</class-b>
|
||||||
|
<field>
|
||||||
|
<a>nom</a>
|
||||||
|
<b>name</b>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<a>surnom</a>
|
||||||
|
<b>nickname</b>
|
||||||
|
</field>
|
||||||
|
</mapping>
|
||||||
|
</mappings>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<mappings xmlns="http://dozer.sourceforge.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://dozer.sourceforge.net
|
||||||
|
http://dozer.sourceforge.net/schema/beanmapping.xsd">
|
||||||
|
<mapping wildcard="false">
|
||||||
|
<class-a>com.baeldung.dozer.Personne</class-a>
|
||||||
|
<class-b>com.baeldung.dozer.Person</class-b>
|
||||||
|
<field>
|
||||||
|
<a>nom</a>
|
||||||
|
<b>name</b>
|
||||||
|
</field>
|
||||||
|
<field>
|
||||||
|
<a>surnom</a>
|
||||||
|
<b>nickname</b>
|
||||||
|
</field>
|
||||||
|
</mapping>
|
||||||
|
</mappings>
|
|
@ -1,13 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry including="**/*.java" kind="src" path="src/main/java"/>
|
|
||||||
<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
|
||||||
<classpathentry kind="var" path="M2_REPO/com/google/code/gson/gson/2.5/gson-2.5.jar"/>
|
|
||||||
<classpathentry kind="var" path="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.7.1-1/jackson-databind-2.7.1-1.jar"/>
|
|
||||||
<classpathentry kind="var" path="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.7.0/jackson-annotations-2.7.0.jar"/>
|
|
||||||
<classpathentry kind="var" path="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.7.1/jackson-core-2.7.1.jar"/>
|
|
||||||
<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
|
|
||||||
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.17/log4j-1.2.17.jar"/>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>gson-jackson-performance</name>
|
|
||||||
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
|
|
||||||
<projects/>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
|
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.jsdt.core.javascriptValidator"/>
|
|
||||||
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
|
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
|
||||||
</launchConfiguration>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>gson</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beansProjectDescription>
|
|
||||||
<version>1</version>
|
|
||||||
<pluginVersion><![CDATA[3.3.0.201307091516-RELEASE]]></pluginVersion>
|
|
||||||
<configSuffixes>
|
|
||||||
<configSuffix><![CDATA[xml]]></configSuffix>
|
|
||||||
</configSuffixes>
|
|
||||||
<enableImports><![CDATA[false]]></enableImports>
|
|
||||||
<configs>
|
|
||||||
<config>src/main/webapp/WEB-INF/api-servlet.xml</config>
|
|
||||||
</configs>
|
|
||||||
<configSets>
|
|
||||||
</configSets>
|
|
||||||
</beansProjectDescription>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="owner.project.facets" value="java"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
|
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.jsdt.core.javascriptValidator"/>
|
|
||||||
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
|
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
|
||||||
</launchConfiguration>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>guava</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" path="src/main/webapp"/>
|
|
||||||
<classpathentry kind="output" path=""/>
|
|
||||||
</classpath>
|
|
|
@ -1,95 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
|
||||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
|
@ -1,55 +0,0 @@
|
||||||
#Sat Jan 21 23:04:06 EET 2012
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
|
|
||||||
sp_cleanup.add_default_serial_version_id=true
|
|
||||||
sp_cleanup.add_generated_serial_version_id=false
|
|
||||||
sp_cleanup.add_missing_annotations=true
|
|
||||||
sp_cleanup.add_missing_deprecated_annotations=true
|
|
||||||
sp_cleanup.add_missing_methods=false
|
|
||||||
sp_cleanup.add_missing_nls_tags=false
|
|
||||||
sp_cleanup.add_missing_override_annotations=true
|
|
||||||
sp_cleanup.add_missing_override_annotations_interface_methods=true
|
|
||||||
sp_cleanup.add_serial_version_id=false
|
|
||||||
sp_cleanup.always_use_blocks=true
|
|
||||||
sp_cleanup.always_use_parentheses_in_expressions=true
|
|
||||||
sp_cleanup.always_use_this_for_non_static_field_access=false
|
|
||||||
sp_cleanup.always_use_this_for_non_static_method_access=false
|
|
||||||
sp_cleanup.convert_to_enhanced_for_loop=true
|
|
||||||
sp_cleanup.correct_indentation=true
|
|
||||||
sp_cleanup.format_source_code=true
|
|
||||||
sp_cleanup.format_source_code_changes_only=true
|
|
||||||
sp_cleanup.make_local_variable_final=true
|
|
||||||
sp_cleanup.make_parameters_final=true
|
|
||||||
sp_cleanup.make_private_fields_final=false
|
|
||||||
sp_cleanup.make_type_abstract_if_missing_method=false
|
|
||||||
sp_cleanup.make_variable_declarations_final=true
|
|
||||||
sp_cleanup.never_use_blocks=false
|
|
||||||
sp_cleanup.never_use_parentheses_in_expressions=false
|
|
||||||
sp_cleanup.on_save_use_additional_actions=true
|
|
||||||
sp_cleanup.organize_imports=true
|
|
||||||
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
|
|
||||||
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
|
|
||||||
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
|
|
||||||
sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
|
|
||||||
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
|
|
||||||
sp_cleanup.remove_private_constructors=true
|
|
||||||
sp_cleanup.remove_trailing_whitespaces=true
|
|
||||||
sp_cleanup.remove_trailing_whitespaces_all=true
|
|
||||||
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
|
|
||||||
sp_cleanup.remove_unnecessary_casts=true
|
|
||||||
sp_cleanup.remove_unnecessary_nls_tags=false
|
|
||||||
sp_cleanup.remove_unused_imports=true
|
|
||||||
sp_cleanup.remove_unused_local_variables=false
|
|
||||||
sp_cleanup.remove_unused_private_fields=true
|
|
||||||
sp_cleanup.remove_unused_private_members=false
|
|
||||||
sp_cleanup.remove_unused_private_methods=true
|
|
||||||
sp_cleanup.remove_unused_private_types=true
|
|
||||||
sp_cleanup.sort_members=false
|
|
||||||
sp_cleanup.sort_members_all=false
|
|
||||||
sp_cleanup.use_blocks=false
|
|
||||||
sp_cleanup.use_blocks_only_for_return_and_throw=false
|
|
||||||
sp_cleanup.use_parentheses_in_expressions=false
|
|
||||||
sp_cleanup.use_this_for_non_static_field_access=true
|
|
||||||
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
|
|
||||||
sp_cleanup.use_this_for_non_static_method_access=true
|
|
||||||
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
|
|
|
@ -1,4 +0,0 @@
|
||||||
activeProfiles=
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
resolveWorkspaceProjects=true
|
|
||||||
version=1
|
|
|
@ -1,2 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
|
||||||
<wb-module deploy-name="spring-rest">
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
|
||||||
<property name="context-root" value="spring-rest"/>
|
|
||||||
<property name="java-output-path" value="/spring-rest/target/classes"/>
|
|
||||||
</wb-module>
|
|
||||||
</project-modules>
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<faceted-project>
|
|
||||||
<installed facet="java" version="1.8"/>
|
|
||||||
</faceted-project>
|
|
|
@ -1 +0,0 @@
|
||||||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
|
@ -1 +0,0 @@
|
||||||
Window
|
|
|
@ -1,14 +0,0 @@
|
||||||
DELEGATES_PREFERENCE=delegateValidatorList
|
|
||||||
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;
|
|
||||||
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;
|
|
||||||
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.303.v201202090300
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
override=true
|
|
||||||
suspend=false
|
|
||||||
vals/org.eclipse.jst.jsf.ui.JSFAppConfigValidator/global=FF01
|
|
||||||
vals/org.eclipse.jst.jsp.core.JSPBatchValidator/global=FF01
|
|
||||||
vals/org.eclipse.jst.jsp.core.JSPContentValidator/global=FF01
|
|
||||||
vals/org.eclipse.jst.jsp.core.TLDValidator/global=FF01
|
|
||||||
vals/org.eclipse.wst.dtd.core.dtdDTDValidator/global=FF01
|
|
||||||
vals/org.eclipse.wst.jsdt.web.core.JsBatchValidator/global=TF02
|
|
||||||
vf.version=3
|
|
|
@ -1,2 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.wst.ws.service.policy.projectEnabled=false
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beansProjectDescription>
|
|
||||||
<version>1</version>
|
|
||||||
<pluginVersion><![CDATA[3.3.0.201307091516-RELEASE]]></pluginVersion>
|
|
||||||
<configSuffixes>
|
|
||||||
<configSuffix><![CDATA[xml]]></configSuffix>
|
|
||||||
</configSuffixes>
|
|
||||||
<enableImports><![CDATA[false]]></enableImports>
|
|
||||||
<configs>
|
|
||||||
<config>src/main/webapp/WEB-INF/api-servlet.xml</config>
|
|
||||||
</configs>
|
|
||||||
<configSets>
|
|
||||||
</configSets>
|
|
||||||
</beansProjectDescription>
|
|
|
@ -11,91 +11,91 @@ import com.google.common.base.Function;
|
||||||
|
|
||||||
public class GuavaMapFromSet<K, V> extends AbstractMap<K, V> {
|
public class GuavaMapFromSet<K, V> extends AbstractMap<K, V> {
|
||||||
|
|
||||||
private class SingleEntry implements Entry<K, V> {
|
private class SingleEntry implements Entry<K, V> {
|
||||||
private K key;
|
private K key;
|
||||||
|
|
||||||
public SingleEntry( K key) {
|
public SingleEntry(K key) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public K getKey() {
|
public K getKey() {
|
||||||
return this.key;
|
return this.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V getValue() {
|
public V getValue() {
|
||||||
V value = GuavaMapFromSet.this.cache.get(this.key);
|
V value = GuavaMapFromSet.this.cache.get(this.key);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
value = GuavaMapFromSet.this.function.apply(this.key);
|
value = GuavaMapFromSet.this.function.apply(this.key);
|
||||||
GuavaMapFromSet.this.cache.put(this.key, value);
|
GuavaMapFromSet.this.cache.put(this.key, value);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V setValue( V value) {
|
public V setValue(V value) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MyEntrySet extends AbstractSet<Entry<K, V>> {
|
private class MyEntrySet extends AbstractSet<Entry<K, V>> {
|
||||||
|
|
||||||
public class EntryIterator implements Iterator<Entry<K, V>> {
|
public class EntryIterator implements Iterator<Entry<K, V>> {
|
||||||
private Iterator<K> inner;
|
private Iterator<K> inner;
|
||||||
|
|
||||||
public EntryIterator() {
|
public EntryIterator() {
|
||||||
this.inner = MyEntrySet.this.keys.iterator();
|
this.inner = MyEntrySet.this.keys.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
return this.inner.hasNext();
|
return this.inner.hasNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map.Entry<K, V> next() {
|
public Map.Entry<K, V> next() {
|
||||||
K key = this.inner.next();
|
K key = this.inner.next();
|
||||||
return new SingleEntry(key);
|
return new SingleEntry(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<K> keys;
|
private Set<K> keys;
|
||||||
|
|
||||||
public MyEntrySet( Set<K> keys) {
|
public MyEntrySet(Set<K> keys) {
|
||||||
this.keys = keys;
|
this.keys = keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<Map.Entry<K, V>> iterator() {
|
public Iterator<Map.Entry<K, V>> iterator() {
|
||||||
return new EntryIterator();
|
return new EntryIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
return this.keys.size();
|
return this.keys.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private WeakHashMap<K, V> cache;
|
private WeakHashMap<K, V> cache;
|
||||||
private Set<Entry<K, V>> entries;
|
private Set<Entry<K, V>> entries;
|
||||||
private Function<? super K, ? extends V> function;
|
private Function<? super K, ? extends V> function;
|
||||||
|
|
||||||
public GuavaMapFromSet( Set<K> keys, Function<? super K, ? extends V> function) {
|
public GuavaMapFromSet(Set<K> keys, Function<? super K, ? extends V> function) {
|
||||||
this.function = function;
|
this.function = function;
|
||||||
this.cache = new WeakHashMap<K, V>();
|
this.cache = new WeakHashMap<K, V>();
|
||||||
this.entries = new MyEntrySet(keys);
|
this.entries = new MyEntrySet(keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Map.Entry<K, V>> entrySet() {
|
public Set<Map.Entry<K, V>> entrySet() {
|
||||||
return this.entries;
|
return this.entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,54 +13,52 @@ import com.google.common.base.Function;
|
||||||
|
|
||||||
public class GuavaMapFromSetTests {
|
public class GuavaMapFromSetTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenStringSet_whenMapsToElementLength_thenCorrect() {
|
public void givenStringSet_whenMapsToElementLength_thenCorrect() {
|
||||||
Function<Integer, String> function = new Function<Integer, String>() {
|
Function<Integer, String> function = new Function<Integer, String>() {
|
||||||
|
@Override
|
||||||
|
public String apply(Integer from) {
|
||||||
|
return Integer.toBinaryString(from);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Set<Integer> set = new TreeSet<>(Arrays.asList(32, 64, 128));
|
||||||
|
Map<Integer, String> map = new GuavaMapFromSet<Integer, String>(set, function);
|
||||||
|
assertTrue(map.get(32).equals("100000")
|
||||||
|
&& map.get(64).equals("1000000")
|
||||||
|
&& map.get(128).equals("10000000"));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Test
|
||||||
public String apply(Integer from) {
|
public void givenIntSet_whenMapsToElementBinaryValue_thenCorrect() {
|
||||||
return Integer.toBinaryString(from.intValue());
|
Function<String, Integer> function = new Function<String, Integer>() {
|
||||||
}
|
|
||||||
};
|
|
||||||
Set<Integer> set = (Set<Integer>) new TreeSet<Integer>(Arrays.asList(
|
|
||||||
32, 64, 128));
|
|
||||||
Map<Integer, String> map = new GuavaMapFromSet<Integer, String>(set,
|
|
||||||
function);
|
|
||||||
assertTrue(map.get(32).equals("100000")
|
|
||||||
&& map.get(64).equals("1000000")
|
|
||||||
&& map.get(128).equals("10000000"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Override
|
||||||
public void givenIntSet_whenMapsToElementBinaryValue_thenCorrect() {
|
public Integer apply(String from) {
|
||||||
Function<String, Integer> function = new Function<String, Integer>() {
|
return from.length();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Set<String> set = new TreeSet<>(Arrays.asList(
|
||||||
|
"four", "three", "twelve"));
|
||||||
|
Map<String, Integer> map = new GuavaMapFromSet<String, Integer>(set,
|
||||||
|
function);
|
||||||
|
assertTrue(map.get("four") == 4 && map.get("three") == 5
|
||||||
|
&& map.get("twelve") == 6);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Test
|
||||||
public Integer apply(String from) {
|
public void givenSet_whenNewSetElementAddedAndMappedLive_thenCorrect() {
|
||||||
return from.length();
|
Function<String, Integer> function = new Function<String, Integer>() {
|
||||||
}
|
|
||||||
};
|
|
||||||
Set<String> set = (Set<String>) new TreeSet<String>(Arrays.asList(
|
|
||||||
"four", "three", "twelve"));
|
|
||||||
Map<String, Integer> map = new GuavaMapFromSet<String, Integer>(set,
|
|
||||||
function);
|
|
||||||
assertTrue(map.get("four") == 4 && map.get("three") == 5
|
|
||||||
&& map.get("twelve") == 6);
|
|
||||||
}
|
|
||||||
@Test
|
|
||||||
public void givenSet_whenNewSetElementAddedAndMappedLive_thenCorrect() {
|
|
||||||
Function<String, Integer> function = new Function<String, Integer>() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer apply(String from) {
|
public Integer apply(String from) {
|
||||||
return from.length();
|
return from.length();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Set<String> set = (Set<String>) new TreeSet<String>(Arrays.asList(
|
Set<String> set = new TreeSet<>(Arrays.asList(
|
||||||
"four", "three", "twelve"));
|
"four", "three", "twelve"));
|
||||||
Map<String, Integer> map = new GuavaMapFromSet<String, Integer>(set,
|
Map<String, Integer> map = new GuavaMapFromSet<String, Integer>(set,
|
||||||
function);
|
function);
|
||||||
set.add("one");
|
set.add("one");
|
||||||
assertTrue(map.get("one") == 3 && map.size()==4);
|
assertTrue(map.get("one") == 3 && map.size() == 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>guava18</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>guava19</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,32 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
|
@ -1,54 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>spring-static-resources</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.springframework.ide.eclipse.core.springbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.hibernate.eclipse.console.hibernateBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
|
||||||
<nature>org.springframework.ide.eclipse.core.springnature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
|
||||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
|
||||||
<nature>org.hibernate.eclipse.console.hibernateNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,16 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beansProjectDescription>
|
|
||||||
<version>1</version>
|
|
||||||
<pluginVersion><![CDATA[3.6.0.201407080615-RELEASE]]></pluginVersion>
|
|
||||||
<configSuffixes>
|
|
||||||
<configSuffix><![CDATA[xml]]></configSuffix>
|
|
||||||
</configSuffixes>
|
|
||||||
<enableImports><![CDATA[true]]></enableImports>
|
|
||||||
<configs>
|
|
||||||
</configs>
|
|
||||||
<autoconfigs>
|
|
||||||
<config>src/main/webapp/WEB-INF/mvc-servlet.xml</config>
|
|
||||||
</autoconfigs>
|
|
||||||
<configSets>
|
|
||||||
</configSets>
|
|
||||||
</beansProjectDescription>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="owner.project.facets" value="java"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
|
|
||||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.jsdt.core.javascriptValidator"/>
|
|
||||||
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
|
|
||||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
|
||||||
</launchConfiguration>
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>httpclient</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue