java.lang.Object
org.glavo.classfile.constant.ConstantUtils
Helper methods for the implementation of
java.lang.constant.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe special name of class initialization methods, "<clinit>".static final ConstantDesc[]an empty constant descriptorstatic final StringThe special name of instance initialization methods, "<init>".static final MethodTypeDescNominal descriptor representing the method descriptor()V, taking no argument and returningvoid. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringValidates the correctness of a binary package name.static StringValidates the correctness of an internal package name.static StringvalidateMemberName(String name, boolean method) Validates a member namestatic StringvalidateModuleName(String name) Validates the correctness of a module name.
-
Field Details
-
INIT_NAME
The special name of instance initialization methods, "<init>". An instance initialization method has this special name and isvoid.- Since:
- 21
- See Also:
- Jvms:
- 2.9.1 Instance Initialization Methods
-
CLASS_INIT_NAME
The special name of class initialization methods, "<clinit>". A class initialization method has this special name, ACC_STATIC flag set, isvoidand takes no arguments.- Since:
- 21
- See Also:
- Jvms:
- 2.9.2 Class Initialization Methods
-
MTD_void
Nominal descriptor representing the method descriptor()V, taking no argument and returningvoid.- Since:
- 21
-
EMPTY_CONSTANTDESC
an empty constant descriptor
-
-
Constructor Details
-
ConstantUtils
public ConstantUtils()
-
-
Method Details
-
validateBinaryPackageName
Validates the correctness of a binary package name. In particular checks for the presence of invalid characters in the name. Empty package name is allowed.- Parameters:
name- the package name- Returns:
- the package name passed if valid
- Throws:
IllegalArgumentException- if the package name is invalidNullPointerException- if the package name isnull
-
validateInternalPackageName
Validates the correctness of an internal package name. In particular checks for the presence of invalid characters in the name. Empty package name is allowed.- Parameters:
name- the package name- Returns:
- the package name passed if valid
- Throws:
IllegalArgumentException- if the package name is invalidNullPointerException- if the package name isnull
-
validateModuleName
Validates the correctness of a module name. In particular checks for the presence of invalid characters in the name. Empty module name is allowed. Module and Package Names- Parameters:
name- the module name- Returns:
- the module name passed if valid
- Throws:
IllegalArgumentException- if the module name is invalidNullPointerException- if the module name isnull
-
validateMemberName
Validates a member name- Parameters:
name- the name of the member- Returns:
- the name passed if valid
- Throws:
IllegalArgumentException- if the member name is invalid
-