diff --git a/README.md b/README.md index 44cbb71..de20e29 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ -## JISEL: Java Interface Segregation Library -Interface Segregation Library for Java 17 +# JISEL: Java Interface Segregation Library +Minimum Java 17 Required -Pitch Video: -... +Pitch Video: https://youtu.be/nkbu6zxV3R0 -### How to Install ? +## Installation If you are running a Maven project, add the latest release dependency to your pom.xml ```xml @@ -14,35 +13,98 @@ If you are running a Maven project, add the latest release dependency to your po 1.0 ``` +You will also need to include the same dependency as an additional annotation processor in the Maven Compiler plugin of your project +```xml + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 17 + -Xlint:unchecked + + + org.jisel + jisel + 1.0 + + + + + + +``` + For other build tools, please check: [Maven Central](https://search.maven.org/artifact/org.jisel/jisel/1.0/jar). -### Use on your declared bloated interfaces methods +## Provided Annotations +### @SealForProfile / @SealForProfiles +To be used only on abstract methods of the large interfaces you need to segregate ```java -import SealForProfile; +public interface Sociable { + + String STUDENT = "Student"; + String WORKER = "Worker"; + String ACTIVE_WORKER = "ActiveWorker"; + + @SealForProfiles({STUDENT, WORKER, ACTIVE_WORKER}) + String startConversation(); + + @SealForProfile(STUDENT) + boolean attendClass(String fieldOfStudy); + + @SealForProfile(STUDENT) + void askForHelpWhenNeeded(); + + @SealForProfile(WORKER) + @SealForProfile(ACTIVE_WORKER) + // both annotations above can be replaced with: @SealForProfiles({WORKER, ACTIVE_WORKER}) + boolean[] joinOfficeSocialGroups(String[] groups, int maximum); -public interface InterfaceA { - @SealForProfile - void something(); + @SealForProfile(ACTIVE_WORKER) + void leadOfficeSocialGroup(String groupName); + + @SealForProfile(ACTIVE_WORKER) + double createNewOfficeSocialGroup(String groupName, List starters); } ``` -### Use on your declared child classes implementing generated sealed interfaces - +### @AddToProfile / @AddToProfiles +To be used only on classes (or interfaces) implementing (or extending) any of the sealed interfaces generated by the use of @SealForProfile(s) ```java -import AddToProfile; +@AddToProfiles(profiles = {STUDENT, WORKER}, largeInterface = "com.bayor.jisel.annotation.client.hierarchicalinheritance.Sociable") +// the above line can be replaced with the following 2: +// @AddToProfile(profile = STUDENT, largeInterface = "com.bayor.jisel.annotation.client.hierarchicalinheritance.Sociable") +// @AddToProfile(profile = WORKER, largeInterface = "com.bayor.jisel.annotation.client.hierarchicalinheritance.Sociable") +public final class StudentWorkerHybrid implements SealedStudentSociable, SealedWorkerSociable { + @Override + public String startConversation() throws IllegalStateException { + return null; + } + + @Override + public void askForHelpWhenNeeded() { + + } -@AddToProfile("PROFILE_NAME") -public final class ClientA implements SealedInterfaceA { - // ... + @Override + public boolean attendClass(String param0) throws IllegalArgumentException { + return false; + } + + @Override + public boolean[] joinOfficeSocialGroups(String[] param0, int param1) { + return new boolean[0]; + } } + ``` -### Sample classes for testing +### Sample interfaces and classes for testing [https://github.com/mohamed-ashraf-bayor/jisel-annotation-client](https://github.com/mohamed-ashraf-bayor/jisel-annotation-client) -### Invalid Uses of Jisel -The annotation should be used ONLY on interfaces created in your own project. - ### Issues, Bugs, Suggestions Contribute to the project's growth by reporting issues or making improvement suggestions [here](https://github.com/mohamed-ashraf-bayor/jisel/issues/new/choose) diff --git a/pom.xml b/pom.xml index 42df985..e8cfd51 100644 --- a/pom.xml +++ b/pom.xml @@ -9,8 +9,8 @@ jar Jisel - Interface Segregation Library for Java 17 - http://jisel.org + Java Interface Segregation Library + https://jisel.org/ @@ -21,7 +21,7 @@ - scm:git:git://github.com/mohamed-ashraf-bayor/froporec.git + scm:git:git://github.com/mohamed-ashraf-bayor/jisel.git scm:git:git@github.com:mohamed-ashraf-bayor/mohamed-ashraf-bayor.git https://github.com/mohamed-ashraf-bayor/jisel HEAD diff --git a/src/main/java/org/jisel/AddToProfile.java b/src/main/java/org/jisel/AddToProfile.java index 9577e1f..db8d434 100644 --- a/src/main/java/org/jisel/AddToProfile.java +++ b/src/main/java/org/jisel/AddToProfile.java @@ -32,7 +32,7 @@ /** * Annotation to be applied on top of a class, an interface or a record which is implementing or extending a sealed interface generated by Jisel.

* All sealed interfaces generated by Jisel follow the naming convention: Sealed<ProfileName><LargeInterfaceSimpleName>
- * See @AddToProfile attributes documentation.

+ * See @{@link AddToProfile} attributes documentation.

*/ @Retention(RetentionPolicy.SOURCE) @Target({ElementType.TYPE}) @@ -65,7 +65,7 @@ @Target(ElementType.TYPE) @interface AddToProfilez { /** - * array attribute allowing @AddToProfile to be repeatable + * array attribute allowing @{@link AddToProfile} to be repeatable * * @return array of @AddToProfile instances */ diff --git a/src/main/java/org/jisel/AddToProfiles.java b/src/main/java/org/jisel/AddToProfiles.java index 5d60a99..4a7d201 100644 --- a/src/main/java/org/jisel/AddToProfiles.java +++ b/src/main/java/org/jisel/AddToProfiles.java @@ -32,7 +32,7 @@ /** * Annotation to be applied on top of a class, an interface or a record which is implementing or extending a sealed interface generated by Jisel.

* All sealed interfaces generated by Jisel follow the naming convention: Sealed<ProfileName><LargeInterfaceSimpleName>
- * See @AddToProfile attributes documentation.

+ * See @{@link AddToProfiles} attributes documentation.

*/ @Retention(RetentionPolicy.SOURCE) @Target({ElementType.TYPE}) @@ -40,7 +40,7 @@ public @interface AddToProfiles { /** - * Not Required - specifies an array containing the names of any of the profiles used with the @SealForProfile annotations in the large interface definition. + * Not Required - specifies an array containing the names of any of the profiles used with the @{@link SealForProfile} annotations in the large interface definition. * Each one of the profiles names corresponds to the <ProfileName> from the sealed interfaces naming convention.
* If not provided or empty, the annotated class, interface or record will be added to the permits list of the generated parent sealed interface.
* Also, each one of the provided profiles names MUST be one of the profiles defined in the large interface definition using @SealForProfile. If not, @@ -59,13 +59,13 @@ String largeInterface(); /** - * Internal annotation allowing @AddToProfiles to be repeatable + * Internal annotation allowing @{@link AddToProfiles} to be repeatable */ @Retention(RetentionPolicy.SOURCE) @Target(ElementType.TYPE) @interface AddToProfilezz { /** - * array attribute allowing @AddToProfiles to be repeatable + * array attribute allowing @{@link AddToProfiles} to be repeatable * * @return array of @AddToProfiles instances */ diff --git a/src/main/java/org/jisel/JiselAnnotationProcessor.java b/src/main/java/org/jisel/JiselAnnotationProcessor.java index 8b4c5f4..f54981b 100644 --- a/src/main/java/org/jisel/JiselAnnotationProcessor.java +++ b/src/main/java/org/jisel/JiselAnnotationProcessor.java @@ -59,7 +59,7 @@ import static org.jisel.generator.StringGenerator.ORG_JISEL_SEAL_FOR_PROFILEZZ; /** - * Jisel annotation processor class. Picks up and processes all elements annotated with @SealForProfile, @SealForProfiles, @AddToProfile and @AddToProfiles
+ * Jisel annotation processor class. Picks up and processes all elements annotated with @{@link SealForProfile}, @{@link SealForProfiles}, @{@link AddToProfile} and @{@link AddToProfiles}
*/ @SupportedAnnotationTypes({ORG_JISEL_SEAL_FOR_PROFILE, ORG_JISEL_SEAL_FOR_PROFILES, ORG_JISEL_SEAL_FOR_PROFILEZ, ORG_JISEL_SEAL_FOR_PROFILEZZ, ORG_JISEL_ADD_TO_PROFILE, ORG_JISEL_ADD_TO_PROFILES, ORG_JISEL_ADD_TO_PROFILEZ, ORG_JISEL_ADD_TO_PROFILEZZ}) @@ -76,8 +76,7 @@ public class JiselAnnotationProcessor extends AbstractProcessor implements Strin private final SealedInterfaceSourceFileGenerator sealedInterfaceSourceFileGenerator; /** - * Constructor of JiselAnnotationProcessor. - * Initializes unique instances of SealForProfileHandler, AddToProfileHandler and SealedInterfaceSourceFileGenerator to be used within the class + * JiselAnnotationProcessor constructor. Initializes needed instances of {@link SealForProfileHandler}, {@link AddToProfileHandler} and {@link SealedInterfaceSourceFileGenerator} */ public JiselAnnotationProcessor() { this.sealForProfileHandler = new SealForProfileHandler(); diff --git a/src/main/java/org/jisel/SealForProfile.java b/src/main/java/org/jisel/SealForProfile.java index d7b0729..ed0c289 100644 --- a/src/main/java/org/jisel/SealForProfile.java +++ b/src/main/java/org/jisel/SealForProfile.java @@ -32,7 +32,7 @@ * For the specified profile name, a sealed interface will be generated following the naming convention: * Sealed<ProfileName><LargeInterfaceSimpleName>

* <LargeInterfaceSimpleName> corresponds to the simplename of the interface being segregated.

- * See @SealForProfile attributes documentation.

+ * See @{@link SealForProfile} attributes documentation.

*/ @Retention(RetentionPolicy.SOURCE) @Target({ElementType.METHOD}) @@ -48,13 +48,13 @@ String value(); /** - * Internal annotation allowing @SealForProfile to be repeatable + * Internal annotation allowing @{@link SealForProfile} to be repeatable */ @Retention(RetentionPolicy.SOURCE) @Target(ElementType.METHOD) @interface SealForProfilez { /** - * array attribute allowing @SealForProfile to be repeatable + * array attribute allowing @{@link SealForProfile} to be repeatable * * @return array of @SealForProfile instances */ diff --git a/src/main/java/org/jisel/SealForProfiles.java b/src/main/java/org/jisel/SealForProfiles.java index c4ae86d..7160cd0 100644 --- a/src/main/java/org/jisel/SealForProfiles.java +++ b/src/main/java/org/jisel/SealForProfiles.java @@ -31,7 +31,7 @@ * Annotation to be applied only on top of abstract methods of an interface you intend to segregate.

* For each one of the specified profiles names, a sealed interface will be generated following the naming convention: Sealed<ProfileName><LargeInterfaceSimpleName>

* <LargeInterfaceSimpleName> corresponds to the simplename of the interface being segregated.

- * See @SealForProfiles attributes documentation.

+ * See @{@link SealForProfiles} attributes documentation.

*/ @Retention(RetentionPolicy.SOURCE) @Target({ElementType.METHOD}) @@ -47,13 +47,13 @@ String[] value(); /** - * Internal annotation allowing @SealForProfiles to be repeatable + * Internal annotation allowing @{@link SealForProfiles} to be repeatable */ @Retention(RetentionPolicy.SOURCE) @Target(ElementType.METHOD) @interface SealForProfilezz { /** - * array attribute allowing @SealForProfiles to be repeatable + * array attribute allowing @{@link SealForProfiles} to be repeatable * * @return array of @SealForProfiles instances */ diff --git a/src/main/java/org/jisel/generator/CodeGenerator.java b/src/main/java/org/jisel/generator/CodeGenerator.java index a4ebf68..dee78ce 100644 --- a/src/main/java/org/jisel/generator/CodeGenerator.java +++ b/src/main/java/org/jisel/generator/CodeGenerator.java @@ -55,16 +55,16 @@ sealed interface ExtendsGenerator extends CodeGenerator, StringGenerator permits /** * Generates the "extends" clause of a sealed interface being generated, along with the list of parent interfaces, based on - * a provided Map containing parents/subtypes information (the permits Map) and the name of the profile for which the + * a provided {@link Map} containing parents/subtypes information (the permits Map) and the name of the profile for which the * sealed interface will be generated * * @param processingEnvironment {@link ProcessingEnvironment} object, needed to access low-level information regarding the used annotations - * @param sealedInterfaceContent StringBuilder object containing the sealed interface code being generated - * @param permitsMap Map containing parents/subtypes information. The Map key is the profile name whose generated + * @param sealedInterfaceContent {@link StringBuilder} object containing the sealed interface code being generated + * @param permitsMap {@link Map} containing parents/subtypes information. The Map key is the profile name whose generated * sealed interface will be a parent interface, while the value is the list of profiles names whose * sealed interfaces will be generated as subtypes * @param processedProfile name of the profile whose sealed interface is being generated - * @param largeInterfaceElement Element instance of the large interface being segregated + * @param largeInterfaceElement {@link Element} instance of the large interface being segregated */ void generateExtendsClauseFromPermitsMapAndProcessedProfile( ProcessingEnvironment processingEnvironment, @@ -96,15 +96,15 @@ sealed interface PermitsGenerator extends CodeGenerator, StringGenerator permits /** * Generates the "permits" clause of a sealed interface being generated, along with the list of parent interfaces, based on - * a provided Map containing parents/subtypes information (the permits Map) and the name of the profile for which the + * a provided {@link Map} containing parents/subtypes information (the permits Map) and the name of the profile for which the * sealed interface will be generated * - * @param sealedInterfaceContent StringBuilder object containing the sealed interface code being generated - * @param permitsMap Map containing parents/subtypes information. The Map key is the profile name whose generated + * @param sealedInterfaceContent {@link StringBuilder} object containing the sealed interface code being generated + * @param permitsMap {@link Map} containing parents/subtypes information. The Map key is the profile name whose generated * sealed interface will be a parent interface, while the value is the list of profiles names whose * sealed interfaces will be generated as subtypes * @param processedProfile name of the profile whose sealed interface is being generated - * @param largeInterfaceElement Element instance of the large interface being segregated + * @param largeInterfaceElement {@link Element} instance of the large interface being segregated */ void generatePermitsClauseFromPermitsMapAndProcessedProfile( StringBuilder sealedInterfaceContent, @@ -123,14 +123,14 @@ default void generateCode(final StringBuilder classOrInterfaceContent, final Lis } /** - * Adds a generated final class to the Map containing parents/subtypes information, only for the sealed interfaces at the - * lowest-level of the generated hierarchy (also know as childless interfaces).
+ * Adds a generated final class to the {@link Map} containing parents/subtypes information, only for the sealed interfaces at the + * lowest-level of the generated hierarchy (also known as childless interfaces).
* Practice proper to Jisel only to avoid compilation errors for sealed interfaces not having any existing subtypes * - * @param permitsMap Map containing parents/subtypes information. The Map key is the profile name whose generated + * @param permitsMap {@link Map} containing parents/subtypes information. The Map key is the profile name whose generated * sealed interface will be a parent interface, while the value is the list of profiles names whose * sealed interfaces will be generated as subtypes - * @param largeInterfaceElement Element instance of the large interface being segregated + * @param largeInterfaceElement {@link Element} instance of the large interface being segregated */ default void addFinalClassToPermitsMap(final Map> permitsMap, final Element largeInterfaceElement) { var finalClassName = UNDERSCORE + largeInterfaceElement.getSimpleName().toString() + FINAL_CLASS_SUFFIX; @@ -154,8 +154,8 @@ sealed interface MethodsGenerator extends CodeGenerator, StringGenerator permits /** * Generates a list of abstracts methods definitions and appends it to the sealed interface code being generated * - * @param sealedInterfaceContent StringBuilder object containing the sealed interface code being generated - * @param methodsSet Set of {@link Element} instances representing each one of the abstract methods to generate + * @param sealedInterfaceContent {@link StringBuilder} object containing the sealed interface code being generated + * @param methodsSet {@link Set} of {@link Element} instances representing each one of the abstract methods to generate */ void generateAbstractMethodsFromElementsSet(StringBuilder sealedInterfaceContent, Set methodsSet); @@ -163,8 +163,8 @@ sealed interface MethodsGenerator extends CodeGenerator, StringGenerator permits * Mainly used for a final class generation.
* Generates a list of concrete methods definitions (signature and body), and appends it to the final class being generated * - * @param sealedInterfaceContent StringBuilder object containing the sealed interface code being generated - * @param methodsSet Set of {@link Element} instances representing each one of the abstract methods to generate + * @param sealedInterfaceContent {@link StringBuilder} object containing the sealed interface code being generated + * @param methodsSet {@link Set} of {@link Element} instances representing each one of the abstract methods to generate */ void generateEmptyConcreteMethodsFromElementsSet(StringBuilder sealedInterfaceContent, Set methodsSet); @@ -177,7 +177,7 @@ default void generateCode(final StringBuilder classOrInterfaceContent, final Lis * Checks whether the provided method {@link Element} instance has any arguments * * @param methodElement method {@link Element} instance - * @return true if the provided method has any arguments + * @return true if the provided method has any arguments, false otherwise */ default boolean methodHasArguments(final Element methodElement) { return methodElement.toString().indexOf(CLOSING_PARENTHESIS) - methodElement.toString().indexOf(OPENING_PARENTHESIS) > 1; diff --git a/src/main/java/org/jisel/generator/FinalClassContentGenerator.java b/src/main/java/org/jisel/generator/FinalClassContentGenerator.java index 8705b5e..1dfb540 100644 --- a/src/main/java/org/jisel/generator/FinalClassContentGenerator.java +++ b/src/main/java/org/jisel/generator/FinalClassContentGenerator.java @@ -58,7 +58,7 @@ public FinalClassContentGenerator() { * * @param processingEnvironment {@link ProcessingEnvironment} object, needed to access low-level information regarding the used annotations * @param largeInterfaceElement {@link Element} instance of the large interface being segregated - * @param sealedInterfacesPermitsMap Map containing information about the subtypes permitted by each one of the sealed interfaces to be generated + * @param sealedInterfacesPermitsMap {@link Map} containing information about the subtypes permitted by each one of the sealed interfaces to be generated * @return the final class string content */ public String generateFinalClassContent( diff --git a/src/main/java/org/jisel/generator/JavaxGeneratedGenerator.java b/src/main/java/org/jisel/generator/JavaxGeneratedGenerator.java index d54d79c..0f153d5 100644 --- a/src/main/java/org/jisel/generator/JavaxGeneratedGenerator.java +++ b/src/main/java/org/jisel/generator/JavaxGeneratedGenerator.java @@ -32,7 +32,7 @@ import static java.lang.String.format; /** - * Generates the @javax.annotation.processing.Generated annotation section at the top of the generated interfaces or classes with the attributes: value, date and comments
+ * Generates the {@link javax.annotation.processing.Generated} annotation section at the top of the generated interfaces or classes with the attributes: value, date and comments
*/ public final class JavaxGeneratedGenerator implements CodeGenerator { diff --git a/src/main/java/org/jisel/generator/ReportGenerator.java b/src/main/java/org/jisel/generator/ReportGenerator.java index ac31fcb..924f863 100644 --- a/src/main/java/org/jisel/generator/ReportGenerator.java +++ b/src/main/java/org/jisel/generator/ReportGenerator.java @@ -56,8 +56,8 @@ public class ReportGenerator implements StringGenerator { * Generates a Report file listing all generated sealed interfaces for the provided large interfaces. * * @param largeInterfaceElement {@link Element} instance of the large interface being segregated - * @param sealedInterfacesToGenerateMap Map containing information about the sealed interfaces to be generated - * @param sealedInterfacesPermitsMap Map containing information about the subtypes permitted by each one of the sealed interfaces to be generated + * @param sealedInterfacesToGenerateMap {@link Map} containing information about the sealed interfaces to be generated + * @param sealedInterfacesPermitsMap {@link Map} containing information about the subtypes permitted by each one of the sealed interfaces to be generated * @return a string containing the text report */ public String generateReportForBloatedInterface(final Element largeInterfaceElement, diff --git a/src/main/java/org/jisel/generator/SealedInterfaceContentGenerator.java b/src/main/java/org/jisel/generator/SealedInterfaceContentGenerator.java index 14a9dc1..68503d6 100644 --- a/src/main/java/org/jisel/generator/SealedInterfaceContentGenerator.java +++ b/src/main/java/org/jisel/generator/SealedInterfaceContentGenerator.java @@ -55,7 +55,7 @@ public SealedInterfaceContentGenerator() { * Generates the content of a sealed interface * * @param processingEnvironment {@link ProcessingEnvironment} object, needed to access low-level information regarding the used annotations - * @param sealedInterfacesToGenerateMapEntrySet Map.Entry instance containing information about the sealed interfaces to be generated + * @param sealedInterfacesToGenerateMapEntrySet {@link java.util.Map.Entry} instance containing information about the sealed interfaces to be generated * @param largeInterfaceElement {@link Element} instance of the large interface being segregated * @param sealedInterfacesPermitsMap Map containing information about the subtypes permitted by each one of the sealed interfaces to be generated * @return the string content of the sealed interface to generate diff --git a/src/main/java/org/jisel/generator/SealedInterfaceSourceFileGenerator.java b/src/main/java/org/jisel/generator/SealedInterfaceSourceFileGenerator.java index 1697e78..7860490 100644 --- a/src/main/java/org/jisel/generator/SealedInterfaceSourceFileGenerator.java +++ b/src/main/java/org/jisel/generator/SealedInterfaceSourceFileGenerator.java @@ -32,18 +32,41 @@ import java.util.Map; import java.util.Set; +/** + * Creates the content of a sealed interface and writes it to the filesystem.
+ * The sealed interface generation process also includes the final class and report generation + */ public class SealedInterfaceSourceFileGenerator implements StringGenerator { private final SealedInterfaceContentGenerator sealedInterfaceContentGenerator; private final FinalClassContentGenerator finalClassContentGenerator; private final ReportGenerator reportGenerator; + /** + * SealedInterfaceSourceFileGenerator constructor. Creates needed instances of {@link SealedInterfaceContentGenerator}, + * {@link FinalClassContentGenerator} and {@link ReportGenerator} + */ public SealedInterfaceSourceFileGenerator() { this.sealedInterfaceContentGenerator = new SealedInterfaceContentGenerator(); this.finalClassContentGenerator = new FinalClassContentGenerator(); this.reportGenerator = new ReportGenerator(); } + /** + * @param processingEnvironment {@link ProcessingEnvironment} object, needed to access low-level information regarding the used annotations + * @param sealedInterfacesToGenerateByLargeInterface {@link Map} containing information about the sealed interfaces to be generated. + * To be populated and/or modified if needed. The key represents the {@link Element} instance of + * each one of the large interfaces to be segregated, while the associated value is + * a Map of profile name as the key and a Set of Element instances as the value. + * The Element instances represent each one of the abstract methods to be + * added to the generated sealed interface corresponding to a profile. + * @param sealedInterfacesPermitsByLargeInterface Map containing information about the subtypes permitted by each one of the sealed interfaces to be generated. + * To be populated and/or modified if needed. The key represents the Element instance of + * each one of the large interfaces to be segregated, while the associated value is + * a Map of profile name as the key and a List of profiles names as the value. + * @return List of all created source files + * @throws IOException if an I/O error occured + */ public List createSourceFiles(final ProcessingEnvironment processingEnvironment, final Map>> sealedInterfacesToGenerateByLargeInterface, final Map>> sealedInterfacesPermitsByLargeInterface) throws IOException { diff --git a/src/main/java/org/jisel/generator/StringGenerator.java b/src/main/java/org/jisel/generator/StringGenerator.java index 7389dbf..5b93c80 100644 --- a/src/main/java/org/jisel/generator/StringGenerator.java +++ b/src/main/java/org/jisel/generator/StringGenerator.java @@ -153,12 +153,12 @@ public interface StringGenerator { */ String ANNOTATION_VALUES_REGEX = "\"([^\"]*)\""; /** - * Regex expression to read attributes information provided using the AddToProfile annotation.
+ * Regex expression to read attributes information provided using the {@link org.jisel.AddToProfile} annotation.
* Sample value to be parsed by the regex: @org.jisel.AddToProfile(profile="ActiveWorker", largeInterface="com.bayor.jisel.annotation.client.data.Sociable") */ String ADD_TO_PROFILE_REGEX = "AddToProfile\\((.*?)\\)"; /** - * Regex expression to read attributes information provided using the AddToProfiles annotation.
+ * Regex expression to read attributes information provided using the {@link org.jisel.AddToProfiles} annotation.
* Sample value to be parsed by the regex: @org.jisel.AddToProfiles(profiles={"Student", "Worker"}, largeInterface="com.bayor.jisel.annotation.client.data.Sociable") */ String ADD_TO_PROFILES_REGEX = "AddToProfiles\\((.*?)\\)"; @@ -170,7 +170,7 @@ public interface StringGenerator { String STATUS_REPORT_TITLE = "JISEL GENERATION REPORT"; /** - * Displayed only when a "severe" error occured while a sealed interface file was being generated + * Displayed only when a "severe" error occurred while a sealed interface file was being generated */ String FILE_GENERATION_ERROR = "Error generating sealed interfaces"; /** @@ -179,35 +179,35 @@ public interface StringGenerator { String FILE_GENERATION_SUCCESS = "Successfully generated"; /** - * Fully qualified name of the SealForProfile annotation + * Fully qualified name of the {@link org.jisel.SealForProfile} annotation */ String ORG_JISEL_SEAL_FOR_PROFILE = "org.jisel.SealForProfile"; /** - * Fully qualified name of the SealForProfiles annotation + * Fully qualified name of the {@link org.jisel.SealForProfiles} annotation */ String ORG_JISEL_SEAL_FOR_PROFILES = "org.jisel.SealForProfiles"; /** - * Fully qualified name of the SealForProfilez annotation + * Fully qualified name of the {@link org.jisel.SealForProfile.SealForProfilez} annotation */ String ORG_JISEL_SEAL_FOR_PROFILEZ = "org.jisel.SealForProfile.SealForProfilez"; /** - * Fully qualified name of the SealForProfilezz annotation + * Fully qualified name of the {@link org.jisel.SealForProfiles.SealForProfilezz} annotation */ String ORG_JISEL_SEAL_FOR_PROFILEZZ = "org.jisel.SealForProfiles.SealForProfilezz"; /** - * Fully qualified name of the AddToProfile annotation + * Fully qualified name of the {@link org.jisel.AddToProfile} annotation */ String ORG_JISEL_ADD_TO_PROFILE = "org.jisel.AddToProfile"; /** - * Fully qualified name of the AddToProfiles annotation + * Fully qualified name of the {@link org.jisel.AddToProfiles} annotation */ String ORG_JISEL_ADD_TO_PROFILES = "org.jisel.AddToProfiles"; /** - * Fully qualified name of the AddToProfilez annotation + * Fully qualified name of the {@link org.jisel.AddToProfile.AddToProfilez} annotation */ String ORG_JISEL_ADD_TO_PROFILEZ = "org.jisel.AddToProfile.AddToProfilez"; /** - * Fully qualified name of the AddToProfilezz annotation + * Fully qualified name of the {@link org.jisel.AddToProfiles.AddToProfilezz} annotation */ String ORG_JISEL_ADD_TO_PROFILEZZ = "org.jisel.AddToProfiles.AddToProfilezz"; @@ -264,11 +264,11 @@ static String removeCommaSeparator(final String text) { } /** - * Constructs a string based on the provided profile and a large interface Element instance, according to the naming convention:
+ * Constructs a string based on the provided profile and a large interface {@link Element} instance, according to the naming convention:
* Sealed<ProfileName><LargeInterfaceSimpleName>

* * @param profile name of the profile - * @param interfaceElement Element instance of the large interface to be segregated + * @param interfaceElement {@link Element} instance of the large interface to be segregated * @return a string following Jisel sealed interface naming convention */ default String sealedInterfaceNameConvention(final String profile, final Element interfaceElement) { @@ -283,11 +283,11 @@ default String sealedInterfaceNameConvention(final String profile, final Element } /** - * Constructs a string based on the provided profiles and a large interface Element instance, according to the naming convention:
+ * Constructs a string based on the provided profiles and a large interface {@link Element} instance, according to the naming convention:
* Sealed<ProfileName><LargeInterfaceSimpleName>

* - * @param profiles List of profiles names - * @param interfaceElement Element instance of the large interface to be segregated + * @param profiles {@link List} of profiles names + * @param interfaceElement {@link Element} instance of the large interface to be segregated * @return a List of string literals following Jisel sealed interface naming convention */ default List sealedInterfaceNameConventionForList(final List profiles, final Element interfaceElement) { @@ -302,9 +302,9 @@ default List sealedInterfaceNameConventionForList(final List pro } /** - * Constructs the java package name based on an Element instance of the large interface to be segregated. + * Constructs the java package name based on an {@link Element} instance of the large interface to be segregated. * - * @param largeInterfaceElement Element instance of the large interface to be segregated + * @param largeInterfaceElement {@link Element} instance of the large interface to be segregated * @return the package name if any */ default Optional generatePackageName(final Element largeInterfaceElement) { @@ -316,8 +316,8 @@ default Optional generatePackageName(final Element largeInterfaceElement /** * Replace all double occurences of whitespace (" ") into a single whitespace (" ") * - * @param text contains double occurences of whitespace - * @return the provided text with all double occurences of whitespace replaced with a single occurence + * @param text contains double occurrences of whitespace + * @return the provided text with all double occurrences of whitespace replaced with a single occurence */ default String removeDoubleSpaceOccurrences(final String text) { return text.replace(WHITESPACE + WHITESPACE, WHITESPACE); diff --git a/src/main/java/org/jisel/handlers/JiselAnnotationHandler.java b/src/main/java/org/jisel/handlers/JiselAnnotationHandler.java index 6372f13..e08a5eb 100644 --- a/src/main/java/org/jisel/handlers/JiselAnnotationHandler.java +++ b/src/main/java/org/jisel/handlers/JiselAnnotationHandler.java @@ -44,17 +44,17 @@ import static org.jisel.generator.StringGenerator.removeCommaSeparator; /** - * Interface exposing contract to fulfill by any class handling the elements annotated with @SealForProfile and @AddToProfile annotations + * Exposes contract to fulfill by any class handling all elements annotated with @{@link org.jisel.SealForProfile}(s) and @{@link org.jisel.AddToProfile}(s) annotations */ public sealed interface JiselAnnotationHandler extends StringGenerator permits SealForProfileHandler, AddToProfileHandler, AnnotationInfoCollectionHandler, UniqueParentInterfaceHandler, ParentChildInheritanceHandler { /** - * Reads values of all attributes provided through the use of @SealForProfile and @AddToProfile annotations and + * Reads values of all attributes provided through the use of @{@link org.jisel.SealForProfile} and @{@link org.jisel.AddToProfile} annotations and * populates the provided Map arguments * * @param processingEnv {@link ProcessingEnvironment} object, needed to access low-level information regarding the used annotations - * @param allAnnotatedElements Set of Element instances representing all classes annotated with @AddToProfile and + * @param allAnnotatedElements {@link Set} of {@link Element} instances representing all classes annotated with @AddToProfile and * all abstract methods annotated with @SealForProfile * @param sealedInterfacesToGenerateByLargeInterface Map containing information about the sealed interfaces to be generated. * To be populated and/or modified if needed. The key represents the Element instance of @@ -74,11 +74,11 @@ Map handleAnnotatedElements(ProcessingEnvironment processingEnv Map>> sealedInterfacesPermitsByLargeInterface); /** - * For a specified class or interface annotated with @AddToProfile, constructs a Map storing a Set of all the provided + * For a specified class or interface annotated with @{@link org.jisel.AddToProfile}, constructs a Map storing a Set of all the provided * profiles names (as the Map value) for each one of the large interfaces names (as the Map key) provided through @AddToProfile. * * @param processingEnv {@link ProcessingEnvironment} object, needed to access low-level information regarding the used annotations - * @param annotatedClassOrInterface Element instance representing the annotated class or interface + * @param annotatedClassOrInterface {@link Element} instance representing the annotated class or interface * @return a Map storing a Set of all the provided profiles names (as the Map value) for each one of the large interfaces names (as the Map key) */ default Map> buildAddToProfileProvidedProfilesMap(final ProcessingEnvironment processingEnv, final Element annotatedClassOrInterface) { @@ -126,10 +126,10 @@ private void updateProvidedProfilesMapBasedOnProfilesSet(final Map buildSealForProfileProvidedProfilesSet(final ProcessingEnvironment processingEnv, final Element annotatedMethod) { @@ -155,7 +155,7 @@ default Set buildSealForProfileProvidedProfilesSet(final ProcessingEnvir } /** - * Interface exposing contract to fulfill by any class dedicated to collecting necessary information from the annotated elements, + * Exposes contract to fulfill by any class dedicated to collecting necessary information from the annotated elements, * in order to populate the {@link Map} containing the sealed interfaces information to be generated */ sealed interface AnnotationInfoCollectionHandler extends JiselAnnotationHandler permits SealForProfileInfoCollectionHandler { @@ -164,7 +164,7 @@ sealed interface AnnotationInfoCollectionHandler extends JiselAnnotationHandler * Populates the Map containing the sealed interfaces information to be generated * * @param processingEnv {@link ProcessingEnvironment} object, needed to access low-level information regarding the used annotations - * @param allAnnotatedElements {@link Set} of Element instances representing all classes annotated with @AddToProfile and + * @param allAnnotatedElements {@link Set} of {@link Element} instances representing all classes annotated with @AddToProfile and * all abstract methods annotated with @SealForProfile * @param sealedInterfacesToGenerateByLargeInterface Map containing information about the sealed interfaces to be generated. * To be populated and/or modified if needed. The key represents the {@link Element} instance of @@ -181,9 +181,9 @@ void populateSealedInterfacesMap(ProcessingEnvironment processingEnv, * Creates intermediate parent interfaces based on common methods of provided profiles, then stores the created intermediate * parent interfaces in the Map containing the sealed interfaces information to be generated * - * @param annotatedMethodsByProfileByLargeInterface Set of all annotated abstract methods for a specified profile - * @param sealedInterfacesToGenerateByLargeInterface Map containing information about the sealed interfaces to be generated. - * To be populated and/or modified if needed. The key represents the Element instance of + * @param annotatedMethodsByProfileByLargeInterface {@link Set} of all annotated abstract methods for a specified profile + * @param sealedInterfacesToGenerateByLargeInterface {@link Map} containing information about the sealed interfaces to be generated. + * To be populated and/or modified if needed. The key represents the {@link Element} instance of * each one of the large interfaces to be segregated, while the associated value is * a Map of profile name as the key and a Set of Element instances as the value. * The Element instances represent each one of the abstract methods to be @@ -251,7 +251,7 @@ default Map handleAnnotatedElements(final ProcessingEnvironment } /** - * Interface exposing contract to fulfill by any class dedicated to building parent-children relations based on information provided in + * Exposes contract to fulfill by any class dedicated to building parent-children relations based on information provided in * the Map containing the sealed interfaces information to be generated */ sealed interface ParentChildInheritanceHandler extends JiselAnnotationHandler permits SealForProfileParentChildInheritanceHandler { @@ -259,8 +259,8 @@ sealed interface ParentChildInheritanceHandler extends JiselAnnotationHandler pe /** * Reads information stored in the Map containing the sealed interfaces information to be generated, and populates another Map storing subtypes of the provided profiles * - * @param sealedInterfacesToGenerateByLargeInterface Map containing information about the sealed interfaces to be generated. - * To be populated and/or modified if needed. The key represents the Element instance of + * @param sealedInterfacesToGenerateByLargeInterface {@link Map} containing information about the sealed interfaces to be generated. + * To be populated and/or modified if needed. The key represents the {@link Element} instance of * each one of the large interfaces to be segregated, while the associated value is * a Map of profile name as the key and a Set of Element instances as the value. * The Element instances represent each one of the abstract methods to be @@ -279,9 +279,9 @@ void buildInheritanceRelations(Map>> sealedInt /** * Populates a Map storing subtypes of the provided profiles * - * @param interfaceElement large interface Element instance - * @param sealedInterfacesToGenerateByLargeInterface Map containing information about the sealed interfaces to be generated. - * To be populated and/or modified if needed. The key represents the Element instance of + * @param interfaceElement large interface {@link Element} instance + * @param sealedInterfacesToGenerateByLargeInterface {@link Map} containing information about the sealed interfaces to be generated. + * To be populated and/or modified if needed. The key represents the {@link Element} instance of * each one of the large interfaces to be segregated, while the associated value is * a Map of profile name as the key and a Set of Element instances as the value. * The Element instances represent each one of the abstract methods to be @@ -328,8 +328,8 @@ default Map handleAnnotatedElements(final ProcessingEnvironment } /** - * Interface exposing contract to fulfill by any class dedicated to checking for the presence of an unique parent interface - * based on information provided in the Map containing the sealed interfaces information to be generated + * Exposes contract to fulfill by any class dedicated to checking for the presence of an unique parent interface based on + * information provided in the Map containing the sealed interfaces information to be generated */ sealed interface UniqueParentInterfaceHandler extends JiselAnnotationHandler permits SealForProfileUniqueParentInterfaceHandler { @@ -345,7 +345,7 @@ sealed interface UniqueParentInterfaceHandler extends JiselAnnotationHandler per * added to the generated sealed interface corresponding to a profile. * @return Map providing information about the presence of an unique parent sealed interface detected based on common methods of profiles.
* The informational message provided is a String literal describing the absence of an unique parent sealed interface, - * for each one of the provided large interfces to be segregated + * for each one of the provided large interfaces to be segregated */ Map checkAndHandleUniqueParentInterface(Map>> sealedInterfacesToGenerateByLargeInterface); @@ -353,7 +353,7 @@ sealed interface UniqueParentInterfaceHandler extends JiselAnnotationHandler per * Checks for the presence of an unique parent interface based on information provided in the Map containing the sealed interfaces information to be generated * * @param sealedInterfacesToGenerateByLargeInterface Map containing information about the sealed interfaces to be generated. - * To be populated and/or modified if needed. The key represents the Element instance of + * To be populated and/or modified if needed. The key represents the {@link Element} instance of * each one of the large interfaces to be segregated, while the associated value is * a Map of profile name as the key and a Set of Element instances as the value. * The Element instances represent each one of the abstract methods to be diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 3c4359c..a0fcd6a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,5 @@ -info.app.name = Jisel +info.app.name = JISEL info.app.version = 1.0 -info.app.description = Interface Segregation Library for Java 17 +info.app.description = Java Interface Segregation Library info.app.contact.name = Mohamed Ashraf Bayor info.app.contact.url = https://jisel.org/ \ No newline at end of file