The sublibrary Lib-Tag-Core
contains the core functionalities to perform the
CRUD (Create
, Read
, Update
and Delete
) operations for a Tag.
A Tag
is a simple String which can be used for example in a Button, Label
or another JavaFX components. Suchlike tagged topics can be easily searched or
analyzed for a Tag
.
Image: UML Lib-Tag
Hint
TheUML
diagram is created with theOnline Modeling Platform
GenMyModel.
It is very easy to create a Tag with the fluent builder TagBuilder:
/**
* With the fluent builder {@code Class} {@link com.github.naoghuman.lib.tag.core.TagBuilder}
* the developer can easily create an instance from the {@code Interface}
* {@link com.github.naoghuman.lib.tag.core.Tag}.
* <ul>
* <li>The first two attributes {@code id} and {@code title} are mandory.</li>
* <li>All other attributes are optional, that means skipping them returns {@link java.util.Optional#empty()}.</li>
* <li>Any attribute (mandory or optional if set) will be validate against {@link com.github.naoghuman.lib.tag.internal.DefaultTagValidator}.</li>
* </ul>
*
* @author Naoghuman
* @since 0.1.0
* @version 0.4.0
* @see com.github.naoghuman.lib.tag.core.Tag
* @see com.github.naoghuman.lib.tag.core.TagBuilder
* @see com.github.naoghuman.lib.tag.internal.DefaultTagValidator
* @see java.util.Optional#empty()
*/
final Tag tag = TagBuilder.create()
.id(Tag.DEFAULT_ID) // mandory (NOT NULL)
.title("title") // mandory (NOT NULL && NOT EMPTY)
.generationTime(Long.MIN_VALUE) // mandory (NOT NULL)
.description("description") // optional
.style("style") // optional
.build();
The same as a Business process modeling (BPM) diagram (create with the tool Bizagi Modeler BPMN):
Image: Business process modeling diagram from TagBuilder
Hint
. The generation from aTag
starts with the methodcreate()
.
.Green
rectangles aremandory
attributes.
.Blue
rectangles areoptional
attributes.
. TheTag
will then created with the last methodbuild()
.
Additional informations
- Design Pattern: Fluent Interface
- Design Pattern: Builder pattern
- Design Pattern: Step builder pattern
To identify the container and the assoziated Tags from the container a unique id
is required. Here comes the following fluent builder in the game:
/**
* With the fluent builder {@code Class} {@link com.github.naoghuman.lib.tag.core.TagContainerIdBuilder}
* the developer can create easily an unique {@code Id} and returned it as a {@link java.lang.String}.
* <p>
* The main point from this {@code builder} is the possibility to generate an unique {@code Id} for a relation
* between a {@link com.github.naoghuman.lib.tag.core.Tag} and the container where the {@code Tag} will be embbeded.
*
* <ul>
* <li>All attributes are {@code mandory}.</li>
* <li>All defined values will be validate against the {@code Interface} {@link com.github.naoghuman.lib.tag.internal.DefaultTagValidator}.</li>
* </ul>
*
* @author Naoghuman
* @since 0.4.0
* @version 0.4.0
* @see com.github.naoghuman.lib.tag.core.Tag
* @see com.github.naoghuman.lib.tag.core.TagRelation
* @see com.github.naoghuman.lib.tag.internal.DefaultTagValidator
*/
final String tagContainerId = TagContainerIdBuilder.create()
.path(TagContainerId.class) // mandory (NOT NULL)
.container(AnchorPane.class) // mandory (NOT NULL)
.containerId("container-id") // mandory (NOT NULL && NOT EMPTY)
.build();
Again the same as a Business process modeling (BPM) diagram:
Image: Business process modeling diagram from TagContainerIdBuilder
Hint
. The generation from aTagContainerId
starts with the methodcreate()
.
.Green
rectangles aremandory
attributes.
. TheTagContainerId
will then created with the last methodbuild()
.
Additional informations
- Design Pattern: Fluent Interface
- Design Pattern: Builder pattern
- Design Pattern: Step builder pattern
With a TagRelation its possible to map
a Tag with a specific gui component.
So the application knows
which Tags should be shown for example in a Button
or in a FlowPane.
/**
* With the fluent builder {@code Class} {@link com.github.naoghuman.lib.tag.core.TagRelationBuilder}
* the developer can create easily an instance from the {@code Interface}
* {@link com.github.naoghuman.lib.tag.core.TagRelation}.
* <ul>
* <li>All attributes are {@code mandory}.</li>
* <li>All defined values will be validate against the {@code Interface} {@link com.github.naoghuman.lib.tag.internal.DefaultTagValidator}.</li>
* </ul>
*
* @author Naoghuman
* @since 0.1.0
* @version 0.4.0
* @see com.github.naoghuman.lib.tag.core.TagRelation
* @see com.github.naoghuman.lib.tag.core.TagRelationBuilder
* @see com.github.naoghuman.lib.tag.internal.DefaultTagValidator
*/
final TagRelation tagRelation = TagRelationBuilder.create()
.id(TagRelation.DEFAULT_ID) // mandory (NOT NULL)
.tagId(0L) // mandory (NOT NULL)
.containerId(TagContainerIdBuilder.create()
.path(TagContainerId.class) // mandory (NOT NULL)
.container(AnchorPane.class) // mandory (NOT NULL)
.containerId("container-id") // mandory (NOT NULL && NOT EMPTY)
.build())
.build();
The same like above as a Business process modeling (BPM) diagram (create with the tool Bizagi Modeler BPMN):
Image: Business process modeling diagram from TagRelationBuilder
Hint
. The generation from aTagRelation
starts with the methodcreate()
.
.Green
rectangles aremandory
attributes.
. TheTagRelation
will then created with the last methodbuild()
.
Additional informations
- Design Pattern: Fluent Interface
- Design Pattern: Builder pattern
- Design Pattern: Step builder pattern
The JavaDoc from the library Lib-TAG
can be explored here: JavaDoc Lib-Tag
Current version
is 0.4.0
. Main points in this release are:
- ...
- ...
Download:
- Release v0.4.0 (06.dd.2019 / MM.dd.yyyy)
Maven:
<!-- https://mvnrepository.com/artifact/com.github.naoghuman/lib-tag -->
<dependency>
<groupId>com.github.naoghuman</groupId>
<artifactId>lib-tag</artifactId>
<version>0.4.0</version>
</dependency>
An overview
about all existings releases can be found here:
- Overview from all releases in Lib-Tag.
- On your system you need JRE 8 or JDK 8 installed.
- The library lib-tag-0.4.0.
In the library following dependencies are registered:
- No additional relationship
- If not installed download the JRE 8 or the JDK 8.
- Optional: To work better with FXML files in a JavaFX application download the JavaFX Scene Builder under 'Additional Resources'.
- Choose your preferred IDE (e.g. NetBeans, Eclipse or IntelliJ IDEA) for development.
- Download or clone Lib-Tag.
- Open the projects in your IDE and run them.
The project Lib-Tag
and all sub-projects are licensed under General Public License 3.0.
The project Lib-Tile
and all sub-projects are maintained by me, Peter Rogge. See Contact.
You can reach me under peter.rogge@yahoo.de.