Initial Commit (#142)
* Initial Commit Added Maven Annotation Processor Demo project. Initial commit. * Test - checking * Delete test.rtf * Initial commits Initial commits for sample code * Update SuppressWarningsDemo.java * Code changes till SafeVarargs Code changes till SafeVarargs * Completed source code Completed source code * Final draft Final draft version. Grammarly check done. * Deleted java docs Deleted java docs
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?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"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>AnnotationProcessorDemo</artifactId>
|
||||
<groupId>com.reflectoring.annotation.processor</groupId>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.reflectoring.annotation.processor</groupId>
|
||||
<version>1.0</version>
|
||||
<artifactId>core</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.reflectoring.annotation.processor</groupId>
|
||||
<artifactId>annotation-processor</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.reflectoring.annotation.processor;
|
||||
|
||||
public class Department {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.reflectoring.annotation.processor;
|
||||
|
||||
public class Employee {
|
||||
|
||||
private int id;
|
||||
private String department;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.test;
|
||||
|
||||
import com.reflectoring.annotation.processor.Employee;
|
||||
|
||||
public class BuilderTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Employee employee = new EmployeeBuilder()
|
||||
.department("Sales")
|
||||
.build();
|
||||
|
||||
System.out.println("Employee dept: " + employee.getDepartment());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.test;
|
||||
|
||||
import com.reflectoring.annotation.processor.Department;
|
||||
|
||||
public final class DepartmentBuilder {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
public DepartmentBuilder id(int id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DepartmentBuilder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Department build() {
|
||||
Department department = new Department();
|
||||
department.setId(this.id);
|
||||
department.setName(this.name);
|
||||
|
||||
return department;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.test;
|
||||
|
||||
import com.reflectoring.annotation.processor.Employee;
|
||||
|
||||
public final class EmployeeBuilder {
|
||||
|
||||
private int id;
|
||||
private String department;
|
||||
|
||||
public EmployeeBuilder id(int id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EmployeeBuilder department(String department) {
|
||||
this.department = department;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Employee build() {
|
||||
Employee employee = new Employee();
|
||||
employee.setId(this.id);
|
||||
employee.setDepartment(this.department);
|
||||
|
||||
return employee;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
package com.reflectoring.annotation.processor;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
public final class DepartmentBuilder {
|
||||
private int id;
|
||||
|
||||
private String name;
|
||||
|
||||
public DepartmentBuilder id(int id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DepartmentBuilder name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Department build() {
|
||||
Department department = new Department();
|
||||
department.setId(this.id);
|
||||
department.setName(this.name);
|
||||
return department;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.reflectoring.annotation.processor;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
public final class EmployeeBuilder {
|
||||
private int id;
|
||||
|
||||
private String department;
|
||||
|
||||
public EmployeeBuilder id(int id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EmployeeBuilder department(String department) {
|
||||
this.department = department;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Employee build() {
|
||||
Employee employee = new Employee();
|
||||
employee.setId(this.id);
|
||||
employee.setDepartment(this.department);
|
||||
return employee;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
com\reflectoring\annotation\processor\Employee.class
|
||||
com\reflectoring\annotation\processor\Department.class
|
||||
com\reflectoring\annotation\processor\EmployeeBuilder.class
|
||||
com\reflectoring\annotation\processor\DepartmentBuilder.class
|
||||
@@ -0,0 +1,2 @@
|
||||
D:\Documents\IntelliJ Projects\AnnotationProcessorDemo\core\src\main\java\com\reflectoring\annotation\processor\Employee.java
|
||||
D:\Documents\IntelliJ Projects\AnnotationProcessorDemo\core\src\main\java\com\reflectoring\annotation\processor\Department.java
|
||||
Reference in New Issue
Block a user