APIdia Launch Partner
Top Description Inners Fields Constructors Methods
java.lang

pack-priv final Class PublicMethods

extends Object
Class Inheritance
Imports
jdk.internal.reflect.ReflectionFactory, java.lang.reflect.Method, .Modifier, java.util.Arrays, .LinkedHashMap, .Map

A collection of most specific public methods. Methods are added to it using merge(Method) method. Only the most specific methods for a particular signature are kept.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
PublicMethods.Key

Method (name, parameter types) tuple.

pack-priv static class
PublicMethods.MethodList

Node of a inked list containing Method(s) sharing the same (name, parameter types) tuple.

Field Summary

Modifier and TypeField and Description
private final Map<PublicMethods.Key, PublicMethods.MethodList>
map

a map of (method name, parameter types) -> linked list of Method(s)

private int
methodCount

keeps track of the number of collected methods

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
merge(Method method)

Merges new method with existing methods.

pack-priv Method[]
toArray()

Dumps methods to array.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mapback to summary
private final Map<PublicMethods.Key, PublicMethods.MethodList> map

a map of (method name, parameter types) -> linked list of Method(s)

methodCountback to summary
private int methodCount

keeps track of the number of collected methods

Constructor Detail

PublicMethodsback to summary
pack-priv PublicMethods()

Method Detail

mergeback to summary
pack-priv void merge(Method method)

Merges new method with existing methods. New method is either ignored (if a more specific method with same signature exists) or added to the collection. When it is added to the collection, it may replace one or more existing methods with same signature if they are less specific than added method. See comments in code...

toArrayback to summary
pack-priv Method[] toArray()

Dumps methods to array.

java.lang back to summary

private final Class PublicMethods.Key

extends Object
Class Inheritance

Method (name, parameter types) tuple.

Field Summary

Modifier and TypeField and Description
private final String
private final Class<?>[]
private static final ReflectionFactory

Constructor Summary

AccessConstructor and Description
pack-priv
Key(Method method)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object o)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

pack-priv static boolean
matches(Method method, String name, Class<?>[] ptypes)

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
private final String name
ptypesback to summary
private final Class<?>[] ptypes
reflectionFactoryback to summary
private static final ReflectionFactory reflectionFactory

Constructor Detail

Keyback to summary
pack-priv Key(Method method)

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
matchesback to summary
pack-priv static boolean matches(Method method, String name, Class<?>[] ptypes)
java.lang back to summary

pack-priv final Class PublicMethods.MethodList

extends Object
Class Inheritance

Node of a inked list containing Method(s) sharing the same (name, parameter types) tuple.

Field Summary

Modifier and TypeField and Description
pack-priv Method
pack-priv PublicMethods.MethodList

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static PublicMethods.MethodList
filter(Method[] methods, String name, Class<?>[] ptypes, boolean includeStatic)

Returns: the head of a linked list containing given methods filtered by given method name, parameter types ptypes and including or excluding static methods as requested by includeStatic flag.

pack-priv Method
getMostSpecific()

Returns: 1st method in list with most specific return type

private int
pack-priv static PublicMethods.MethodList
merge(PublicMethods.MethodList head, PublicMethods.MethodList methodList)

This method should only be called with the head (possibly null) of a list of Method(s) that share the same (method name, parameter types) and another methodList that also contains Method(s) with the same and equal (method name, parameter types) as the 1st list.

private static PublicMethods.MethodList
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

methodback to summary
pack-priv Method method
nextback to summary
pack-priv PublicMethods.MethodList next

Constructor Detail

MethodListback to summary
private MethodList(Method method)

Method Detail

filterback to summary
pack-priv static PublicMethods.MethodList filter(Method[] methods, String name, Class<?>[] ptypes, boolean includeStatic)
Returns:PublicMethods.MethodList

the head of a linked list containing given methods filtered by given method name, parameter types ptypes and including or excluding static methods as requested by includeStatic flag.

getMostSpecificback to summary
pack-priv Method getMostSpecific()
Returns:Method

1st method in list with most specific return type

lengthback to summary
private int length()
mergeback to summary
pack-priv static PublicMethods.MethodList merge(PublicMethods.MethodList head, PublicMethods.MethodList methodList)

This method should only be called with the head (possibly null) of a list of Method(s) that share the same (method name, parameter types) and another methodList that also contains Method(s) with the same and equal (method name, parameter types) as the 1st list. It modifies the 1st list and returns the head of merged list containing only the most specific methods for each signature (i.e. return type). The returned head of the merged list may or may not be the same as the head of the given list. The given methodList is not modified.

mergeback to summary
private static PublicMethods.MethodList merge(PublicMethods.MethodList head, Method method)