-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Introduced CommonTypes enum (#1456)
- Loading branch information
1 parent
0cb3f9b
commit d43f2aa
Showing
3 changed files
with
50 additions
and
7 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...ansformation/src/main/java/xyz/keksdose/spoon/code_solver/analyzer/spoon/CommonTypes.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,40 @@ | ||
package xyz.keksdose.spoon.code_solver.analyzer.spoon; | ||
|
||
import spoon.Launcher; | ||
import spoon.reflect.reference.CtTypeReference; | ||
|
||
/** | ||
* The CommonTypes enum represents common types in Java. It is used to provide a convenient way to | ||
* reference common types and their corresponding Class objects. Each enum value represents a | ||
* specific common type, such as STRING, INTEGER, or BOOLEAN. <br> | ||
* Each enum value is associated with a Class object representing the corresponding common type. The | ||
* CommonTypes enum should be used whenever you need to refer to a common type in Java. | ||
*/ | ||
public enum CommonTypes { | ||
STRING(String.class), | ||
INTEGER(Integer.class), | ||
LONG(Long.class), | ||
DOUBLE(Double.class), | ||
FLOAT(Float.class), | ||
BOOLEAN(Boolean.class), | ||
BYTE(Byte.class), | ||
CHARACTER(Character.class), | ||
SHORT(Short.class), | ||
VOID(Void.class), | ||
OBJECT(Object.class); | ||
|
||
private final CtTypeReference<?> clazz; | ||
|
||
CommonTypes(Class<?> clazz) { | ||
this.clazz = new Launcher().getFactory().Type().createReference(clazz); | ||
} | ||
|
||
public CtTypeReference<?> getClazz() { | ||
return clazz; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CommonTypes{" + "clazz=" + clazz.getQualifiedName() + '}'; | ||
} | ||
} |
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