Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Verification for Decision Model and Notation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Blatt
Verification for Decision Model and Notation
Commits
586ae778
Commit
586ae778
authored
5 years ago
by
Jonas Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Add documentation for VTypeRef
parent
ac8f83cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/domain/vdmn/VTypeRef.java
+62
-8
62 additions, 8 deletions
...va/de/unikoblenz/fgbks/core/dmn/domain/vdmn/VTypeRef.java
with
62 additions
and
8 deletions
dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/domain/vdmn/VTypeRef.java
+
62
−
8
View file @
586ae778
...
...
@@ -10,27 +10,49 @@ import de.unikoblenz.fgbks.base.utils.boundary.impl.LongBoundary;
import
de.unikoblenz.fgbks.base.utils.boundary.impl.StringBoundary
;
import
java.time.LocalDateTime
;
import
java.util.Optional
;
import
org.camunda.bpm.model.dmn.instance.TypeRef
;
/**
* Enum for mapping camunda data types {@link TypeRef} to {@link Boundary} classes.
*/
public
enum
VTypeRef
{
/**
* Date format, which is represented as {@link DateBoundary} and as java type {@link
* LocalDateTime}.
*/
DATE
(
"date"
,
LocalDateTime
.
class
,
DateBoundary
.
class
),
/**
* String format, which is represented as {@link StringBoundary} and as java type {@link String}.
*/
STRING
(
"string"
,
String
.
class
,
StringBoundary
.
class
),
/**
* Integer format, which is represented as {@link IntegerBoundary} and as java type {@link
* Integer}.
*/
INTEGER
(
"integer"
,
Integer
.
class
,
IntegerBoundary
.
class
),
/**
* Boolean format, which is represented as {@link BooleanBoundary} and as java type {@link
* Boolean}.
*/
BOOLEAN
(
"boolean"
,
Boolean
.
class
,
BooleanBoundary
.
class
),
/**
* Double format, which is represented as {@link DoubleBoundary} and as java type {@link Double}.
*/
DOUBLE
(
"double"
,
Double
.
class
,
DoubleBoundary
.
class
),
/** Long format, which is represented as {@link LongBoundary} and as java type {@link Long}. */
LONG
(
"long"
,
Long
.
class
,
LongBoundary
.
class
);
private
String
name
;
private
Class
<?>
javaClass
;
private
Class
<?
extends
Boundary
>
boundaryClass
;
public
String
getName
()
{
return
name
;
}
public
Class
<?>
getJavaClass
()
{
return
javaClass
;
}
/**
* Get the {@link VTypeRef} with the given name or {@link null}, if no VTypeRef was found with the
* given name.
*
* @param name the name as String
* @return the {@link VTypeRef} with the given name
*/
public
static
VTypeRef
getTypeRefFromName
(
String
name
)
{
for
(
VTypeRef
typeRef
:
values
())
{
if
(
typeRef
.
name
.
equals
(
name
))
{
...
...
@@ -40,6 +62,13 @@ public enum VTypeRef {
return
null
;
}
/**
* Get the {@link VTypeRef} with the given java {@link Class} or {@link null}, if no VTypeRef was
* found with the given java {@link Class}.
*
* @param javaClass java {@link Class}
* @return the {@link VTypeRef} with the given java {@link Class}
*/
public
static
VTypeRef
getTypeRefFromJavaClass
(
Class
<?>
javaClass
)
{
for
(
VTypeRef
typeRef
:
values
())
{
if
(
typeRef
.
javaClass
.
equals
(
javaClass
))
{
...
...
@@ -49,6 +78,31 @@ public enum VTypeRef {
return
null
;
}
/**
* Get the name of the type.
*
* @return the name as {@link String}.
*/
public
String
getName
()
{
return
name
;
}
/**
* Get the corresponding java class.
*
* @return the java {@link Class}.
*/
public
Class
<?>
getJavaClass
()
{
return
javaClass
;
}
/**
* Get a new {@link Boundary} instance with text as input. If the input text can not be parsed,
* the result is a {@link InvalidBoundary}.
*
* @param text the String to parse the new {@link Boundary}
* @return a Optional of a new {@link Boundary}
*/
public
Optional
<
Boundary
>
getBoundaryFromText
(
String
text
)
{
try
{
return
Optional
.
of
(
boundaryClass
.
getDeclaredConstructor
(
String
.
class
).
newInstance
(
text
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment