Module ClassDefinition

module ClassDefinition: sig .. end
Class definition as well as conversion functions from/to ClassFile.t.

Class definition instances are high-level Java class definitions, low-level definitions being provided by ClassFile.t instances.



Type

type t = {
   access_flags :AccessFlag.for_class list;
   name :Name.for_class;
   extends :Name.for_class option;
   implements :Name.for_class list;
   fields :Field.t list;
   methods :Method.t list;
   attributes :Attribute.for_class list;
}
Definition of a Java class.
val equal : t -> t -> bool
Equality over modules.
val compare : t -> t -> int
Comparison over modules.
val hash : t -> int
Hash function over modules.

Exception

type error = 
| Invalid_class_name
| Bootstrap_methods_defined_twice
| Too_many of string
| Version_error of Version.error
exception Exception of error
val string_of_error : error -> string

Traversal

val map : ClassTraversal.class_definition_mapper ->
t -> t
Applies the "mapper" to the class definition.
val iter : ClassTraversal.class_definition_iterator -> t -> unit
Applies the "iterator" to the class definition.
val fold : ClassTraversal.class_definition_folder ->
t -> ClassTraversal.class_definition_folder
Applies the "folder" to the class definition.

Conversion functions

val decode : ClassFile.t -> t
Converts from a ClassFile.t into a class definition. Raises Exception if an error occurs during conversion.
val encode : ?version:Version.t -> t -> ClassFile.t
Converts a class definition into to a ClassFile.t, using the passed version. The default version is Version.default. Raises Exception if an error occurs during conversion.