-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from QuickWrite/develop
Version 1.0.0
- Loading branch information
Showing
245 changed files
with
6,782 additions
and
6,344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>net.quickwrite</groupId> | ||
<artifactId>fluent4j</artifactId> | ||
<version>0.2.3-alpha</version> | ||
</parent> | ||
|
||
<artifactId>api</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>16</maven.compiler.source> | ||
<maven.compiler.target>16</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
</project> |
28 changes: 28 additions & 0 deletions
28
api/src/main/java/net/quickwrite/fluent4j/ast/FluentFunction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package net.quickwrite.fluent4j.ast; | ||
|
||
import net.quickwrite.fluent4j.ast.pattern.ArgumentList; | ||
import net.quickwrite.fluent4j.ast.placeable.FluentPlaceable; | ||
import net.quickwrite.fluent4j.container.FluentScope; | ||
|
||
/** | ||
* The FluentFunction interface represents a function. | ||
* Functions provide additional functionality available to the | ||
* localizers for formatting data or providing additional data. | ||
*/ | ||
public interface FluentFunction { | ||
/** | ||
* Retrieves the identifier of the function. | ||
* | ||
* @return The identifier of the function | ||
*/ | ||
String getIdentifier(); | ||
|
||
/** | ||
* Evaluates the function with the given scope and argument list. | ||
* | ||
* @param scope The FluentScope used for evaluating | ||
* @param argumentList The ArgumentList containing the arguments passed to the function | ||
* @return A FluentPlaceable representing the evaluated function | ||
*/ | ||
FluentPlaceable parseFunction(final FluentScope scope, final ArgumentList argumentList); | ||
} |
35 changes: 35 additions & 0 deletions
35
api/src/main/java/net/quickwrite/fluent4j/ast/FluentPattern.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package net.quickwrite.fluent4j.ast; | ||
|
||
import net.quickwrite.fluent4j.container.FluentScope; | ||
import net.quickwrite.fluent4j.exception.FluentPatternException; | ||
|
||
/** | ||
* A pattern itself is the base element for the | ||
* message. With that a pattern can be a TextElement | ||
* or a {@link net.quickwrite.fluent4j.ast.placeable.FluentPlaceable}. | ||
*/ | ||
public interface FluentPattern extends FluentResolvable { | ||
/** | ||
* Returns the element that this element links to. If the element | ||
* itself for example is a Message Reference the message itself should be returned. | ||
* | ||
* <hr /> | ||
* | ||
* If the element contains the necessary information directly | ||
* (like a simple Text Element) this should return itself. | ||
* | ||
* @param scope The scope that the link should be unwrapped in | ||
* @return The linked element | ||
* | ||
* @throws FluentPatternException If the linked element does not exist this Exception should be thrown | ||
*/ | ||
FluentPattern unwrap(final FluentScope scope) throws FluentPatternException; | ||
|
||
/** | ||
* Returns a simple string variant of the data that this element contains | ||
* | ||
* @param scope The scope in which this operation should be done | ||
* @return A simple string | ||
*/ | ||
String toSimpleString(final FluentScope scope); | ||
} |
15 changes: 15 additions & 0 deletions
15
api/src/main/java/net/quickwrite/fluent4j/ast/FluentResolvable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package net.quickwrite.fluent4j.ast; | ||
|
||
import net.quickwrite.fluent4j.container.FluentScope; | ||
import net.quickwrite.fluent4j.result.ResultBuilder; | ||
|
||
/** | ||
* The base element for the construction of the message. | ||
*/ | ||
public interface FluentResolvable { | ||
/** | ||
* @param scope The scope which contains the necessary information for this element. | ||
* @param builder The ResultBuilder used for resolving the entity. | ||
*/ | ||
void resolve(final FluentScope scope, final ResultBuilder builder); | ||
} |
67 changes: 67 additions & 0 deletions
67
api/src/main/java/net/quickwrite/fluent4j/ast/entry/FluentAttributeEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package net.quickwrite.fluent4j.ast.entry; | ||
|
||
import net.quickwrite.fluent4j.ast.FluentResolvable; | ||
import net.quickwrite.fluent4j.ast.identifier.FluentIdentifier; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface FluentAttributeEntry extends FluentEntry { | ||
/** | ||
* Returns a list of attributes that this entry has. | ||
* | ||
* <p> | ||
* If there are no entries this should return | ||
* an empty list. | ||
* </p> | ||
* | ||
* @return A list of attributes | ||
*/ | ||
FluentAttributeEntry.Attribute[] getAttributes(); | ||
|
||
/** | ||
* Returns the specific attribute with the given | ||
* identifier. | ||
* <br /> | ||
* If the attribute doesn't exist it will return | ||
* an empty optional. | ||
* | ||
* <p> | ||
* This search for the attribute is a linear search | ||
* with the default implementation and with that has | ||
* a time complexity of {@code O(n)}. | ||
* </p> | ||
* | ||
* @param identifier The identifier of the attribute | ||
* @return The attribute | ||
*/ | ||
default Optional<FluentAttributeEntry.Attribute> getAttribute(final String identifier) { | ||
for (final FluentAttributeEntry.Attribute attribute : getAttributes()) { | ||
if(attribute.getIdentifier().getSimpleIdentifier().equals(identifier)) { | ||
return Optional.of(attribute); | ||
} | ||
} | ||
|
||
return Optional.empty(); | ||
} | ||
|
||
/** | ||
* A single attribute of the FluentEntry. | ||
*/ | ||
interface Attribute extends FluentResolvable { | ||
/** | ||
* Returns the identifier of the attribute | ||
* | ||
* @return The identifier | ||
*/ | ||
FluentIdentifier<String> getIdentifier(); | ||
|
||
/** | ||
* Returns a boolean if the attribute itself can | ||
* be successfully used in a selectable. | ||
* | ||
* @return If the attribute is selectable | ||
*/ | ||
boolean isSelectable(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
api/src/main/java/net/quickwrite/fluent4j/ast/entry/FluentEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package net.quickwrite.fluent4j.ast.entry; | ||
|
||
import net.quickwrite.fluent4j.ast.FluentPattern; | ||
import net.quickwrite.fluent4j.ast.FluentResolvable; | ||
import net.quickwrite.fluent4j.ast.identifier.FluentIdentifier; | ||
|
||
/** | ||
* Represents a single entry that is being used | ||
* inside the parsed resource that holds the translation | ||
* content based upon an identifier. | ||
*/ | ||
public interface FluentEntry extends FluentResolvable, FluentPattern { | ||
/** | ||
* Returns the identifier of this specific entry | ||
* | ||
* @return The identifier | ||
*/ | ||
FluentIdentifier<String> getIdentifier(); | ||
} |
7 changes: 7 additions & 0 deletions
7
api/src/main/java/net/quickwrite/fluent4j/ast/entry/FluentMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package net.quickwrite.fluent4j.ast.entry; | ||
|
||
/** | ||
* Represents a FluentMessage specifically | ||
*/ | ||
public interface FluentMessage extends FluentAttributeEntry { | ||
} |
41 changes: 41 additions & 0 deletions
41
api/src/main/java/net/quickwrite/fluent4j/ast/identifier/FluentIdentifier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package net.quickwrite.fluent4j.ast.identifier; | ||
|
||
/** | ||
* The FluentIdentifier interface represents an identifier. | ||
* Identifiers are used to represent names or keys within the localization messages. | ||
* | ||
* @param <I> The type of the identifier | ||
*/ | ||
public interface FluentIdentifier<I> { | ||
/** | ||
* Retrieves the simple form of the identifier. | ||
* The simple form typically represents the short name or key. | ||
* | ||
* @return The simple form of the identifier | ||
*/ | ||
I getSimpleIdentifier(); | ||
|
||
/** | ||
* Retrieves the full form of the identifier. | ||
* The full form may represent the complete identifier with any additional context or namespace. | ||
* | ||
* @return The full form of the identifier | ||
*/ | ||
I getFullIdentifier(); | ||
|
||
/** | ||
* Calculates the hash code of the identifier. | ||
* | ||
* @return The hash code of the identifier | ||
*/ | ||
int hashCode(); | ||
|
||
/** | ||
* Compares this identifier to the specified object for equality. | ||
* Two identifiers are considered equal if their simple forms are equal. | ||
* | ||
* @param o The object to compare with | ||
* @return true if the specified object is equal to this identifier, false otherwise | ||
*/ | ||
boolean equals(final Object o); | ||
} |
Oops, something went wrong.