Squashed commit of the following: (#10709)
commit 2347e8b21b0d33391e9cb4e79e146756cadfe322 Author: ashleyfrieze <ashley@incredible.org.uk> Date: Tue Apr 27 21:40:33 2021 +0100 Minor tweak to pom commit 0497a9e3e88e9000d335976f311b5e8c1e10675b Merge: a7cf36704b35cc00b59a
Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Mon Apr 26 20:27:13 2021 +0200 Merge branch 'master' into feature/BAEL-4502-compile-time-const commit a7cf36704bbf94a0afa5a9f46969f8e9774ca683 Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Mon Apr 26 20:25:47 2021 +0200 BASE-4502: Update POM commit 86bfe45c4850c31d1505f4bb7a638a3f06621062 Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Sun Apr 25 20:32:35 2021 +0200 BASE-4502: Revert POM changes and comment out JDK9+ code commit b538d1cc19c54c0b9ad9022b94fd066603836e26 Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Sun Apr 25 16:42:47 2021 +0200 BASE-4502: Change parent commit f608783de5f5ee3eda6f2da25d10598327c5aa0f Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Sun Apr 25 16:38:00 2021 +0200 BASE-4502: Maven compiler version commit f15f2b84478b45a7740d78316bec9c253235adf6 Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Sun Apr 25 16:13:05 2021 +0200 BASE-4502: Compile to Java 11 commit 79e780667ca2745198a13b227984e691e4575955 Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Sat Apr 24 08:53:53 2021 +0200 BASE-4502: wrong case commit fca2515c41f653ca735af73e659fb2735b455ce2 Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Sat Apr 10 11:32:59 2021 +0200 BASE-4502: Add space commit 0407a1e40980763f13be598224df5403a12fb8c1 Merge: 54f11d5f05 5621594056 Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Sat Apr 10 11:24:57 2021 +0200 Merge remote-tracking branch 'origin/feature/BAEL-4502-compile-time-const' into feature/BAEL-4502-compile-time-const # Conflicts: # core-java-modules/core-java-lang-4/src/main/java/com/baeldung/compiletimeconstants/ClassConstants.java # core-java-modules/core-java-lang-4/src/main/java/com/baeldung/compiletimeconstants/CompileTimeVariables.java commit 54f11d5f05aef35b9835ea1e2689be0f6e4bcd82 Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Sat Apr 10 11:23:12 2021 +0200 BASE-4502: PR comments and annotation example commit 5621594056bc97f7b2ab7a70e5cf1abcc8ef35a4 Author: daniel.strmecki <daniel.strmecki@ecx.io> Date: Sun Apr 4 12:43:17 2021 +0200 BAEL-4502: Remove unused examples commit b11077e79bf92bcfd6748361e7eb66bcfb20ab06 Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Sat Apr 3 11:14:29 2021 +0200 BASE-4502: Update examples commit 9fea197cd6b5f471bcda4331b722ae308e30b507 Merge: f6e1f2fc46b7cbb5428d
Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Sun Mar 28 17:41:46 2021 +0200 Merge branch 'master' into feature/BAEL-4502-compile-time-const commit f6e1f2fc467949f66eba441bb98f75f8d69c09b8 Author: Daniel Strmecki <daniel.strmecki@gmail.com> Date: Sun Mar 28 17:40:31 2021 +0200 BASE-4502: Compile time examples
This commit is contained in:
parent
6e485ba4f9
commit
8b643c8402
|
@ -39,5 +39,4 @@
|
|||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.baeldung.compiletimeconstants;
|
||||
|
||||
public class Annotations {
|
||||
|
||||
private final String deprecatedDate = "20-02-14";
|
||||
private final String deprecatedTime = "22:00";
|
||||
|
||||
//@Deprecated(since = deprecatedDate + " " + deprecatedTime) //TODO: Required JDK 9+
|
||||
public void deprecatedMethod() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.baeldung.compiletimeconstants;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ClassConstants {
|
||||
|
||||
public static final int MAXIMUM_NUMBER_OF_USERS = 10;
|
||||
public static final String DEFAULT_USERNAME = "unknown";
|
||||
|
||||
public static final Logger log = LoggerFactory.getLogger(ClassConstants.class);
|
||||
public static final List<String> contributorGroups = Arrays.asList("contributor", "author");
|
||||
|
||||
public static final int MAXIMUM_NUMBER_OF_GUESTS = MAXIMUM_NUMBER_OF_USERS * 10;
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.baeldung.compiletimeconstants;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
public class CompileTimeVariables {
|
||||
|
||||
public final String errorMessage = ClassConstants.DEFAULT_USERNAME + " not allowed here.";
|
||||
public final int maximumLoginAttempts = 5;
|
||||
|
||||
public static void main(String[] args) {
|
||||
PrintWriter printWriter = System.console().writer();
|
||||
printWriter.println(ClassConstants.DEFAULT_USERNAME);
|
||||
|
||||
CompileTimeVariables instance = new CompileTimeVariables();
|
||||
printWriter.println(instance.maximumLoginAttempts);
|
||||
|
||||
final String username = "baeldung" + "-" + "user";
|
||||
printWriter.println(username);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.baeldung.compiletimeconstants;
|
||||
|
||||
import java.io.Console;
|
||||
public class RuntimeVariables {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Console console = System.console();
|
||||
|
||||
final String input = console.readLine();
|
||||
console.writer().println(input);
|
||||
|
||||
final double random = Math.random();
|
||||
console.writer().println("Number: " + random);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.baeldung.compiletimeconstants;
|
||||
|
||||
public class SwitchStatement {
|
||||
|
||||
private static final String VALUE_ONE = "value-one";
|
||||
|
||||
public static void main(String[] args) {
|
||||
final String valueTwo = "value" + "-" + "two";
|
||||
switch (args[0]) {
|
||||
case VALUE_ONE:
|
||||
break;
|
||||
case valueTwo:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue