Top Description Constructors Methods
org.apache.commons.pool2.impl

pack-priv Class PoolImplUtils

extends Object
Class Inheritance
Imports
java.lang.reflect.ParameterizedType, .Type, .TypeVariable, java.time.Duration, .Instant, java.time.temporal.ChronoUnit, java.util.Objects, java.util.concurrent.TimeUnit, org.apache.commons.pool2.PooledObjectFactory

Implementation specific utilities.
Since
2.0

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static Class<?>

Returns:

the type of object the factory creates
getFactoryType
(final Class<? extends PooledObjectFactory<T>>
The factory to examine
factoryClass
)

Identifies the concrete type of object that an object factory creates.

private static <
The interface type
T
>
Object

Returns:

concrete type used by the implementation
getGenericType
(final Class<T>
The interface that defines a generic type
type
,
final Class<? extends T>
The class that implements the interface with a concrete type
clazz
)

Gets the concrete type used by an implementation of an interface that uses a generic type.

private static <
The interface type.
T
>
ParameterizedType

Returns:

the matching parameterized type or null.
getParameterizedType
(final Class<T>
The interface that defines a generic type.
type
,
final Class<? extends T>
The class that implements the interface with a concrete type.
clazz
)

Gets the matching parameterized type or null.

private static Object

Returns:

An instance of Class representing the type used by the type parameter or an instance of Integer representing the index for the type in the definition of the defining class
getTypeParameter
(final Class<?>
defining class
clazz
,
final Type
the type argument of interest
argType
)

For a generic parameter, return either the Class used or if the type is unknown, the index for the type in definition of the class

pack-priv static boolean
isPositive(final Duration delay)

pack-priv static Instant

Returns:

the larger of a and b.
max
(final Instant
an argument.
a
,
final Instant
another argument.
b
)

Returns the greater of two Instant values.

pack-priv static Instant

Returns:

the smaller of a and b.
min
(final Instant
an argument.
a
,
final Instant
another argument.
b
)

Returns the smaller of two Instant values.

pack-priv static Duration

Returns:

value if non-null, otherwise defaultValue.
nonNull
(final Duration
May be null.
value
,
final Duration
May not be null/
defaultValue
)

Returns a non-null duration, value if non-null, otherwise defaultValue.

pack-priv static ChronoUnit

Returns:

The corresponding ChronoUnit.
toChronoUnit
(final TimeUnit
A TimeUnit.
timeUnit
)

Converts a TimeUnit to a ChronoUnit.

pack-priv static Duration

Returns:

a Duration.
toDuration
(final long
the amount of the duration, measured in terms of the unit, positive or negative
amount
,
final TimeUnit
the unit that the duration is measured in, must have an exact duration, not null
timeUnit
)

Converts am amount and TimeUnit into a Duration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PoolImplUtilsback to summary
pack-priv PoolImplUtils()

Method Detail

getFactoryTypeback to summary
pack-priv static Class<?> getFactoryType(final Class<? extends PooledObjectFactory<T>> factoryClass)

Identifies the concrete type of object that an object factory creates.

Parameters
factoryClass:Class<? extends PooledObjectFactory<T>>

The factory to examine

Returns:Class<?>

the type of object the factory creates

Annotations
@SuppressWarnings:rawtypes
getGenericTypeback to summary
private static <T> Object getGenericType(final Class<T> type, final Class<? extends T> clazz)

Gets the concrete type used by an implementation of an interface that uses a generic type.

Parameters
<T>
The interface type
type:Class<T>

The interface that defines a generic type

clazz:Class<? extends T>

The class that implements the interface with a concrete type

Returns:Object

concrete type used by the implementation

getParameterizedTypeback to summary
private static <T> ParameterizedType getParameterizedType(final Class<T> type, final Class<? extends T> clazz)

Gets the matching parameterized type or null.

Parameters
<T>
The interface type.
type:Class<T>

The interface that defines a generic type.

clazz:Class<? extends T>

The class that implements the interface with a concrete type.

Returns:ParameterizedType

the matching parameterized type or null.

getTypeParameterback to summary
private static Object getTypeParameter(final Class<?> clazz, final Type argType)

For a generic parameter, return either the Class used or if the type is unknown, the index for the type in definition of the class

Parameters
clazz:Class<?>

defining class

argType:Type

the type argument of interest

Returns:Object

An instance of Class representing the type used by the type parameter or an instance of Integer representing the index for the type in the definition of the defining class

isPositiveback to summary
pack-priv static boolean isPositive(final Duration delay)
maxback to summary
pack-priv static Instant max(final Instant a, final Instant b)

Returns the greater of two Instant values. That is, the result is the argument closer to the value of Instant#MAX. If the arguments have the same value, the result is that same value.

Parameters
a:Instant

an argument.

b:Instant

another argument.

Returns:Instant

the larger of a and b.

minback to summary
pack-priv static Instant min(final Instant a, final Instant b)

Returns the smaller of two Instant values. That is, the result is the argument closer to the value of Instant#MIN. If the arguments have the same value, the result is that same value.

Parameters
a:Instant

an argument.

b:Instant

another argument.

Returns:Instant

the smaller of a and b.

nonNullback to summary
pack-priv static Duration nonNull(final Duration value, final Duration defaultValue)

Returns a non-null duration, value if non-null, otherwise defaultValue.

Parameters
value:Duration

May be null.

defaultValue:Duration

May not be null/

Returns:Duration

value if non-null, otherwise defaultValue.

toChronoUnitback to summary
pack-priv static ChronoUnit toChronoUnit(final TimeUnit timeUnit)

Converts a TimeUnit to a ChronoUnit.

Parameters
timeUnit:TimeUnit

A TimeUnit.

Returns:ChronoUnit

The corresponding ChronoUnit.

toDurationback to summary
pack-priv static Duration toDuration(final long amount, final TimeUnit timeUnit)

Converts am amount and TimeUnit into a Duration.

Parameters
amount:long

the amount of the duration, measured in terms of the unit, positive or negative

timeUnit:TimeUnit

the unit that the duration is measured in, must have an exact duration, not null

Returns:Duration

a Duration.