Java 11498 (#12382)
* added parent lombok-modules * added lombok submodule to parent lombok-modules * added lombok-2 submodule to parent lombok-modules * added lombok-custom submodule to parent lombok-modules * delete lombok submodules that were moved across Co-authored-by: panagiotiskakos <panagiotis.kakos@libra-is.com>
This commit is contained in:
parent
033ddb7a41
commit
02c9bdff35
|
@ -0,0 +1,3 @@
|
||||||
|
## Project Lombok
|
||||||
|
|
||||||
|
This module contains modules about project lombok
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-modules</artifactId>
|
<artifactId>lombok-modules</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-modules</artifactId>
|
<artifactId>lombok-modules</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-modules</artifactId>
|
<artifactId>lombok-modules</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package com.baeldung.lombok.getter;
|
package com.baeldung.lombok.getter;
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Related Article Sections:
|
* Related Article Sections:
|
||||||
* 4. Using @Getter on a Boolean Field
|
* 4. Using @Getter on a Boolean Field
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GetterBoolean {
|
public class GetterBoolean {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Boolean running = true;
|
private Boolean running = true;
|
||||||
}
|
}
|
|
@ -1,16 +1,16 @@
|
||||||
package com.baeldung.lombok.getter;
|
package com.baeldung.lombok.getter;
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Related Article Sections:
|
* Related Article Sections:
|
||||||
* 3. Using @Getter on a boolean Field
|
* 3. Using @Getter on a boolean Field
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GetterBooleanPrimitive {
|
public class GetterBooleanPrimitive {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private boolean running;
|
private boolean running;
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,18 +1,18 @@
|
||||||
package com.baeldung.lombok.getter;
|
package com.baeldung.lombok.getter;
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Related Article Sections:
|
* Related Article Sections:
|
||||||
* 3.2. Two boolean Fields With the Same Accessor Name
|
* 3.2. Two boolean Fields With the Same Accessor Name
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GetterBooleanPrimitiveSameAccessor {
|
public class GetterBooleanPrimitiveSameAccessor {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
boolean running = true;
|
boolean running = true;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
boolean isRunning = false;
|
boolean isRunning = false;
|
||||||
}
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
package com.baeldung.lombok.getter;
|
package com.baeldung.lombok.getter;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Related Article Sections:
|
* Related Article Sections:
|
||||||
* 3.1. A boolean Field Having the Same Name With Its Accessor
|
* 3.1. A boolean Field Having the Same Name With Its Accessor
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GetterBooleanSameAccessor {
|
public class GetterBooleanSameAccessor {
|
||||||
@Getter
|
@Getter
|
||||||
private boolean isRunning = true;
|
private boolean isRunning = true;
|
||||||
}
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
package com.baeldung.lombok.getter;
|
package com.baeldung.lombok.getter;
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Related Article Sections:
|
* Related Article Sections:
|
||||||
* 4. Using @Getter on a Boolean Field
|
* 4. Using @Getter on a Boolean Field
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GetterBooleanType {
|
public class GetterBooleanType {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Boolean running = true;
|
private Boolean running = true;
|
||||||
}
|
}
|
|
@ -1,34 +1,34 @@
|
||||||
package com.baeldung.lombok.getter;
|
package com.baeldung.lombok.getter;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class GetterBooleanUnitTest {
|
public class GetterBooleanUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenBasicBooleanField_thenMethodNamePrefixedWithIsFollowedByFieldName() {
|
public void whenBasicBooleanField_thenMethodNamePrefixedWithIsFollowedByFieldName() {
|
||||||
GetterBooleanPrimitive lombokExamples = new GetterBooleanPrimitive();
|
GetterBooleanPrimitive lombokExamples = new GetterBooleanPrimitive();
|
||||||
assertFalse(lombokExamples.isRunning());
|
assertFalse(lombokExamples.isRunning());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenBooleanFieldPrefixedWithIs_thenMethodNameIsSameAsFieldName() {
|
public void whenBooleanFieldPrefixedWithIs_thenMethodNameIsSameAsFieldName() {
|
||||||
GetterBooleanSameAccessor lombokExamples = new GetterBooleanSameAccessor();
|
GetterBooleanSameAccessor lombokExamples = new GetterBooleanSameAccessor();
|
||||||
assertTrue(lombokExamples.isRunning());
|
assertTrue(lombokExamples.isRunning());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenTwoBooleanFieldsCauseNamingConflict_thenLombokMapsToFirstDeclaredField() {
|
public void whenTwoBooleanFieldsCauseNamingConflict_thenLombokMapsToFirstDeclaredField() {
|
||||||
GetterBooleanPrimitiveSameAccessor lombokExamples = new GetterBooleanPrimitiveSameAccessor();
|
GetterBooleanPrimitiveSameAccessor lombokExamples = new GetterBooleanPrimitiveSameAccessor();
|
||||||
assertTrue(lombokExamples.isRunning() == lombokExamples.running);
|
assertTrue(lombokExamples.isRunning() == lombokExamples.running);
|
||||||
assertFalse(lombokExamples.isRunning() == lombokExamples.isRunning);
|
assertFalse(lombokExamples.isRunning() == lombokExamples.isRunning);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenFieldOfBooleanType_thenLombokPrefixesMethodWithGetInsteadOfIs() {
|
public void whenFieldOfBooleanType_thenLombokPrefixesMethodWithGetInsteadOfIs() {
|
||||||
GetterBooleanType lombokExamples = new GetterBooleanType();
|
GetterBooleanType lombokExamples = new GetterBooleanType();
|
||||||
assertTrue(lombokExamples.getRunning());
|
assertTrue(lombokExamples.getRunning());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>lombok-modules</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
<name>lombok-modules</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>parent-boot-2</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<relativePath>../parent-boot-2</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>lombok</module>
|
||||||
|
<module>lombok-2</module>
|
||||||
|
<module>lombok-custom</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<lombok.version>1.18.20</lombok.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
8
pom.xml
8
pom.xml
|
@ -475,9 +475,7 @@
|
||||||
<module>libraries-testing</module>
|
<module>libraries-testing</module>
|
||||||
<module>linkrest</module>
|
<module>linkrest</module>
|
||||||
<module>logging-modules</module>
|
<module>logging-modules</module>
|
||||||
<module>lombok</module>
|
<module>lombok-modules</module>
|
||||||
<module>lombok-2</module>
|
|
||||||
<module>lombok-custom</module>
|
|
||||||
<module>lucene</module>
|
<module>lucene</module>
|
||||||
|
|
||||||
<module>mapstruct</module>
|
<module>mapstruct</module>
|
||||||
|
@ -919,9 +917,7 @@
|
||||||
<module>libraries-testing</module>
|
<module>libraries-testing</module>
|
||||||
<module>linkrest</module>
|
<module>linkrest</module>
|
||||||
<module>logging-modules</module>
|
<module>logging-modules</module>
|
||||||
<module>lombok</module>
|
<module>lombok-modules</module>
|
||||||
<module>lombok-2</module>
|
|
||||||
<module>lombok-custom</module>
|
|
||||||
<module>lucene</module>
|
<module>lucene</module>
|
||||||
|
|
||||||
<module>mapstruct</module>
|
<module>mapstruct</module>
|
||||||
|
|
Loading…
Reference in New Issue