This repository has been archived by the owner on Jun 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
FXMLModelable.java
104 lines (95 loc) · 4.08 KB
/
FXMLModelable.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* Copyright (C) 2018 - 2019 Naoghuman's dream
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.naoghuman.lib.fxml.core;
import java.util.Optional;
/**
* The {@code FXMLModelable} interface provides different functionalities to
* read and write a {@link com.github.naoghuman.lib.fxml.core.FXMLModel} from
* (to) an entity.
*
* All methods by convention are {@code default}, so the developer can overwrite
* the required functionalities if needed.
*
* @since 0.3.0-PRERELEASE
* @version 0.4.0
* @author Naoghuman
* @see com.github.naoghuman.lib.fxml.core.FXMLModel
*/
public interface FXMLModelable {
/**
* Overwriting this method means that the data from the {@link com.github.naoghuman.lib.fxml.core.FXMLModel}
* will be converted to the entity data by the implemented way.
*
* For more information about how to register functionalities in the {@code FXMLModel}, see the class JavaDoc.
*
* @param model which data should be converted to the entity data.
* @since 0.3.0-PRERELEASE
* @version 0.4.0
* @author Naoghuman
* @see com.github.naoghuman.lib.fxml.core.FXMLModel
*/
public default void readFrom(final FXMLModel model) {
};
/**
* Overwriting this method means that the data from the {@link com.github.naoghuman.lib.fxml.core.FXMLModel}
* will be converted to the entity data depending from the {@code key} by the implemented way.
*
* For more information about how to register functionalities in the {@code FXMLModel}, see the class JavaDoc.
*
* @param key defines the way how to convert the model data to the entity data.
* @param model which data should be converted to the entity data.
* @since 0.4.0
* @version 0.4.0
* @author Naoghuman
* @see com.github.naoghuman.lib.fxml.core.FXMLModel
*/
public default void readFrom(final String key, final FXMLModel model) {
};
/**
* Overwriting this method means that the returned {@link com.github.naoghuman.lib.fxml.core.FXMLModel}
* will be generated by the implemented way.
*
* For more information about how to register functionalities in the {@code FXMLModel}, see the class JavaDoc.
*
* @return the generated FXMLModel wrapped into an Optional or Optional#empty().
* @since 0.3.0-PRERELEASE
* @version 0.4.0
* @author Naoghuman
* @see com.github.naoghuman.lib.fxml.core.FXMLModel
* @see java.util.Optional#empty()
*/
public default Optional<FXMLModel> writeTo() {
return Optional.empty();
};
/**
* Overwriting this method means that the returned {@link com.github.naoghuman.lib.fxml.core.FXMLModel}
* will be generated depending from the {@code key} by the implemented way.
*
* For more information about how to register functionalities in the {@code FXMLModel}, see the class JavaDoc.
*
* @param key which defines the way how to generate the FXMLModel.
* @return the generated FXMLModel wrapped into an Optional or Optional#empty().
* @since 0.4.0
* @version 0.4.0
* @author Naoghuman
* @see com.github.naoghuman.lib.fxml.core.FXMLModel
* @see java.util.Optional#empty()
*/
public default Optional<FXMLModel> writeTo(final String key) {
return Optional.empty();
};
}