Package org.jibx.binding.model
Class ClassUtils
java.lang.Object
org.jibx.binding.model.ClassUtils
Utilities for working with class, field, or method information.
- Author:
- Dennis M. Sosnoski
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IClassItemfindStaticMethod(String name, String[] sigs, ValidationContext vctx) Get static method by fully qualified name.static IClassItemfindVirtualMethod(String name, String[] sigs, ValidationContext vctx) Get virtual method by fully qualified name.static StringgetSignature(String type) Gets the signature string corresponding to a type.static String[]getSignatureVariants(String name, ValidationContext vctx) Get all variant signatures for a fully qualified class name.static booleanisAssignable(String from, String to, ValidationContext vctx) Check if a value of one type can be directly assigned to another type.static booleanisPrimitive(String type) Check if type name is a primitive.
-
Field Details
-
s_variantMap
Map for primitive type signature variants. -
s_signatureMap
Map for signatures corresponding to class names.
-
-
Constructor Details
-
ClassUtils
public ClassUtils()
-
-
Method Details
-
isPrimitive
Check if type name is a primitive.- Parameters:
type-- Returns:
trueif a primitive,falseif not
-
findVirtualMethod
Get virtual method by fully qualified name. This splits the class name from the method name, finds the class, and then tries to find a matching method name in that class or a superclass.- Parameters:
name- fully qualified class and method namesigs- possible method signaturesvctx- validation context (used for class lookup)- Returns:
- information for the method, or
nullif not found
-
findStaticMethod
Get static method by fully qualified name. This splits the class name from the method name, finds the class, and then tries to find a matching method name in that class.- Parameters:
name- fully qualified class and method namesigs- possible method signaturesvctx- validation context (used for class lookup)- Returns:
- information for the method, or
nullif not found
-
getSignatureVariants
Get all variant signatures for a fully qualified class name. The returned array gives all signatures (for interfaces or classes) which instances of the class can match.- Parameters:
name- fully qualified class namevctx- validation context (used for class lookup)- Returns:
- possible signature variations for instances of the class
-
getSignature
Gets the signature string corresponding to a type. The base for the type may be a primitive or class name, and may include trailing array brackets.- Parameters:
type- type name- Returns:
- signature string for type
-
isAssignable
Check if a value of one type can be directly assigned to another type. This is basically the equivalent of the instanceof operator, but with application to primitive types as well as object types.- Parameters:
from- fully qualified class name of initial typeto- fully qualified class name of assignment typevctx- validation context (used for class lookup)- Returns:
trueif assignable,falseif not
-