Package org.jboss.byteman.rule.type
Class TypeHelper
java.lang.Object
org.jboss.byteman.rule.type.TypeHelper
Helpoer class providing static methods for manipulating type and class names,
field and method descriptor names etc
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
idenitfy the number of array dimensions encoded in the supplied typestatic boolean
equalDescriptors
(String desc1, String desc2) static String
externalizeClass
(String className) convert a classname from canonical form to the form used to represent it externally i.e.static String
externalizeDescriptor
(String desc) convert a method descriptor from canonical form to the form used to represent it externallystatic String
externalizeType
(String typeName) convert a type name from canonical form to the form used to represent it externally i.e.static String
internalizeClass
(String className) convert a classname from external form to canonical form.static String
internalizeClass
(String className, boolean arrayBaseOnly) convert a classname from external form to canonical form.static String
internalizeDescriptor
(String desc) convert a method descriptor from the form used to represent it externally to canonical formstatic String
parseMethodDescriptor
(String targetMethod) split off the signature following the method name and return itstatic String
parseMethodName
(String targetMethod) split off the method name preceding the signature and return it
-
Field Details
-
internalNames
list of well known typenames as written in Java code -
externalNames
list of typenames in external form corresponding to entries ni previous list
-
-
Constructor Details
-
TypeHelper
public TypeHelper()
-
-
Method Details
-
equalDescriptors
-
externalizeClass
convert a classname from canonical form to the form used to represent it externally i.e. replace all dots with slashes- Parameters:
className
- the canonical name- Returns:
- the external name
-
internalizeClass
convert a classname from external form to canonical form. equivalent to calling internalizeClass(className, false).- Parameters:
className
- the external name- Returns:
- the canonical name
-
internalizeClass
convert a classname from external form to canonical form. equivalent to calling internalizeClass(className, false). i.e. replace all slashes with dots, replace each leading square left brace with a corresponding trailing square brace pair and remove any L and colon characters bracketing the base type name. if arrayBaseOnly is true then do not append trailing brace pairs- Parameters:
className
- the external namearrayBaseOnly
- omit trailing brace pairs when this is true- Returns:
- the canonical name
-
externalizeType
convert a type name from canonical form to the form used to represent it externally i.e. replace primitive type names by the appropriate single letter types, class names by the externalized class name bracketed by 'L' and ';' and array names by the base type name preceded by '['.- Parameters:
typeName
- the type name- Returns:
- the external name
-
externalizeDescriptor
convert a method descriptor from canonical form to the form used to represent it externally- Parameters:
desc
- the method descriptor which must be trimmed of any surrounding white space- Returns:
- an externalised form for the descriptor
-
internalizeDescriptor
convert a method descriptor from the form used to represent it externally to canonical form- Parameters:
desc
- the method descriptor which must be trimmed of any surrounding white space and start with "(". it must end either with ")" or with ") " followed by an exernalized return type- Returns:
- an internalised form for the descriptor, possibly followed by a space and externalized return type
-
parseMethodName
split off the method name preceding the signature and return it- Parameters:
targetMethod
- - the unqualified method name, possibly including signature- Returns:
- the method name
-
parseMethodDescriptor
split off the signature following the method name and return it- Parameters:
targetMethod
- - the unqualified method name, possibly including signature- Returns:
- the signature
-
dimCount
idenitfy the number of array dimensions encoded in the supplied type- Parameters:
type
- a type in external format- Returns:
- the number of array dimensions encoded in the supplied type
-