module Lookup:sig
..end
type
error =
| |
Invalid_class_query of |
| |
Cannot_find_class of |
| |
Generic_arity_mismatch of |
| |
Generic_cannot_be_parametrized |
| |
Primitive_cannot_be_generic_argument |
| |
Wildcard_cannot_be_generic_argument |
| |
Generic_variable_bound_to_different_values of |
| |
Void_cannot_be_an_array_element_type |
| |
Invalid_generic_bound |
| |
Ambiguity_in_generic_bound |
| |
No_class_match |
| |
Several_class_matches of |
| |
Invalid_field_query of |
| |
No_field_match |
| |
Several_field_matches of |
| |
Invalid_constructor_query of |
| |
No_constructor_match |
| |
Several_constructor_matches of |
| |
Invalid_regular_method_query of |
| |
No_regular_method_match |
| |
Several_regular_method_matches of |
exception Exception of error
val string_of_error : error -> string
typejava_type =
[ `Array of non_void_java_type
| `Boolean
| `Byte
| `Char
| `Class of ClassDefinition.t
| `Double
| `Float
| `Generic of Utils.UTF8.t
| `Int
| `Long
| `Short
| `Void
| `Wildcard ]
Descriptor.java_type
but with
extra cases:`Generic id
to encode a generic type variable designed by an
identifier;`Wildcard
to encode the special name "_"
that can be used
to match any type.typenon_void_java_type =
[ `Array of non_void_java_type
| `Boolean
| `Byte
| `Char
| `Class of ClassDefinition.t
| `Double
| `Float
| `Generic of Utils.UTF8.t
| `Int
| `Long
| `Short
| `Wildcard ]
Descriptor.non_void_java_type
but
with extra cases:`Generic id
to encode a generic type variable designed by an
identifier;`Wildcard
to encode the special name "_"
that can be used
to match any type.typesubstitution =
java_type Utils.UTF8Map.t
type 'a
result = {
|
value : |
(* | The actual result of the query. | *) |
|
with_generics : |
(* | Whether the query was generic-aware. | *) |
|
substitution : |
(* | The substitution of generic type parameters. | *) |
val equal_java_type : java_type -> java_type -> bool
val matches_descriptor : substitution -> java_type -> Descriptor.java_type -> bool
type
for_class
val utf8_for_class : for_class -> Utils.UTF8.t
val make_for_class_from_utf8 : bool -> Utils.UTF8.t -> for_class
make_for_class_from_utf8 generics s
returns a query looking for
classes according to string s
, generics
indicating whether
generic information should be used. A query should be a class name
(possibly unqualified), possibly followed by generic parameters
between angle brackets (if generics
is true
).
Raises Exception
if s
is not well-formed.
val search_for_classes : ?open_packages:Utils.UTF8.t list ->
ClassLoader.t -> for_class -> ClassDefinition.t result list
search_for_classes ~open_packages:op cl q
returns a list of classes
matching query q
found in class loader cl
, op
giving the list
of package prefixes that need not to appear (thus allowing to use
short rather than fully-qualified class names).
Query examples:
"String"
;"java.util.List"
;"java.util.List<T>"
;"java.util.List<int[]>"
;"java.util.List<Object>"
."Fi"
appearing in the class
definition to effective parameters "Ei"
appearing in the query."java.util.List"
will result in an empty substitution;"java.util.List<T>"
will bind "E"
to `Generic "T"
;"java.util.List<java.lang.Integer>"
will bind "E"
to
`Class cd
where cd is the class definition for
java.lang.Integer.val search_for_class : ?open_packages:Utils.UTF8.t list ->
ClassLoader.t -> for_class -> ClassDefinition.t result
search_for_classes
, except that Exception
is raised if
the returned list contains zero or more than one class.val for_classes : bool ->
?open_packages:Utils.UTF8.t list ->
ClassLoader.t -> Utils.UTF8.t -> ClassDefinition.t result list
for_classes generics ~open_packages:op cl s
is a bare shorthand for
search_for_classes ~open_packages:op cl
(make_for_class_from_utf8 generics s)
.val for_class : bool ->
?open_packages:Utils.UTF8.t list ->
ClassLoader.t -> Utils.UTF8.t -> ClassDefinition.t result
for_class generics ~open_packages:op cl s
is a bare shorthand for
search_for_class ~open_packages:op cl
(make_for_class_from_utf8 generics s)
.type
for_field
val utf8_for_field : for_field -> Utils.UTF8.t
val make_for_field_from_utf8 : bool -> Utils.UTF8.t -> for_field
make_for_field_from_utf8 generics s
returns a query looking for
fields according to string s
, generics
indicating whether
generic information should be used. A query should successively
contain:generics
is true
);"_"
to denote any type).Exception
if s
is not well-formed.val search_for_fields : ?open_packages:Utils.UTF8.t list ->
ClassLoader.t ->
for_field -> (ClassDefinition.t * Field.t) result list
search_for_fields ~open_packages:op cl q
returns a list of
class/field couples matching query q
found in class loader cl
,
op
giving the list of package prefixes that need not to appear
(thus allowing to use short rather than fully-qualified class names).
Query examples:
"Integer.MIN_VALUE:_"
;"Integer.digits:char[]"
;"java.util.LinkedList.size:int"
;"java.util.LinkedList<T>.size:int"
;"java.util.LinkedList<Object>.size:int"
.val search_for_field : ?open_packages:Utils.UTF8.t list ->
ClassLoader.t ->
for_field -> (ClassDefinition.t * Field.t) result
search_for_fields
, except that Exception
is raised if the
returned list contains zero or more than one field.val for_fields : bool ->
?open_packages:Utils.UTF8.t list ->
ClassLoader.t ->
Utils.UTF8.t -> (ClassDefinition.t * Field.t) result list
for_fields generics ~open_packages:op cl s
is a bare shorthand for
search_for_fields ~open_packages:op cl
(make_for_field_from_utf8 generics s)
.val for_field : bool ->
?open_packages:Utils.UTF8.t list ->
ClassLoader.t -> Utils.UTF8.t -> (ClassDefinition.t * Field.t) result
for_field generics ~open_packages:op cl s
is a bare shorthand for
search_for_field ~open_packages:op cl
(make_for_field_from_utf8 generics s)
.type
for_constructor
val utf8_for_constructor : for_constructor -> Utils.UTF8.t
val make_for_constructor_from_utf8 : bool -> Utils.UTF8.t -> for_constructor
make_for_constructor_from_utf8 generics s
returns a query looking
for constructors according to string s
, generics
indicating
whether generic information should be used. A query should
successively contain:generics
is true
);"_"
to denote any
type.Exception
if s
is not well-formed.val search_for_constructors : ?open_packages:Utils.UTF8.t list ->
ClassLoader.t ->
for_constructor ->
(ClassDefinition.t * Method.constructor) result list
search_for_constructors ~open_packages:op cl q
returns a list of
class/constructor couples matching query q
found in class loader
cl
, op
giving the list of package prefixes that need not to appear
(thus allowing to use short rather than fully-qualified class names).
Query examples:
"Object()"
;"Integer(int)"
;"java.util.LinkedList()"
;"java.util.LinkedList<T>()"
;"java.util.LinkedList<Object>()"
.val search_for_constructor : ?open_packages:Utils.UTF8.t list ->
ClassLoader.t ->
for_constructor ->
(ClassDefinition.t * Method.constructor) result
search_for_constructors
, except that Exception
is raised
if the returned list contains zero or more than one constructor.val for_constructors : bool ->
?open_packages:Utils.UTF8.t list ->
ClassLoader.t ->
Utils.UTF8.t -> (ClassDefinition.t * Method.constructor) result list
for_constructors generics ~open_packages:op cl s
is a bare shorthand
for search_for_constructors ~open_packages:op cl
(make_for_constructor_from_utf8 generics s)
.val for_constructor : bool ->
?open_packages:Utils.UTF8.t list ->
ClassLoader.t ->
Utils.UTF8.t -> (ClassDefinition.t * Method.constructor) result
for_constructor generics ~open_packages:op cl s
is a bare shorthand
for search_for_constructor ~open_packages:op cl
(make_for_constructor_from_utf8 generics s)
.type
for_regular_method
val utf8_for_regular_method : for_regular_method -> Utils.UTF8.t
val make_for_regular_method_from_utf8 : bool -> Utils.UTF8.t -> for_regular_method
make_for_regular_method_from_utf8 generics s
returns a query looking
for regular methods according to string s
, generics
indicating
whether generic information should be used. A query should
successively contain:generics
is true
);"_"
to denote any
type.Exception
if s
is not well-formed.val search_for_regular_methods : ?open_packages:Utils.UTF8.t list ->
ClassLoader.t ->
for_regular_method ->
(ClassDefinition.t * Method.regular) result list
search_for_regular_methods ~open_packages:op cl q
returns a list of
class/method couples matching query q
found in class loader cl
,
op
giving the list of package prefixes that need not to appear
(thus allowing to use short rather than fully-qualified class names).
Query examples:
"Object.clone()"
;"Object.equals(Object)"
;"java.util.LinkedList.get(int):Object"
;"java.util.LinkedList<T>.get(int):T"
;"java.util.LinkedList<Object>.get(int):Object"
.val search_for_regular_method : ?open_packages:Utils.UTF8.t list ->
ClassLoader.t ->
for_regular_method ->
(ClassDefinition.t * Method.regular) result
search_for_regular_methods
, except that Exception
is raised
if the returned list contains zero or more than one regular method.val for_regular_methods : bool ->
?open_packages:Utils.UTF8.t list ->
ClassLoader.t ->
Utils.UTF8.t -> (ClassDefinition.t * Method.regular) result list
for_regular_methods generics ~open_packages:op cl s
is a bare shorthand
for search_for_regular_methods ~open_packages:op cl
(make_for_regular_method_from_utf8 generics s)
.val for_regular_method : bool ->
?open_packages:Utils.UTF8.t list ->
ClassLoader.t ->
Utils.UTF8.t -> (ClassDefinition.t * Method.regular) result
for_regular_method generics ~open_packages:op cl s
is a bare shorthand
for search_for_regular_method ~open_packages:op cl
(make_for_regular_method_from_utf8 generics s)
.