Package org.testng.internal
Interface IObject
- All Known Implementing Classes:
ClassImpl
,NoOpTestClass
public interface IObject
Represents the associations of a class with one or more instances. Relevant with
@Factory
annotation.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
A wrapper class that wraps around an array and associates a unique Id that can be used as a key for the array.static class
A wrapper object that associates a unique id to every unique test class object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addObject
(IObject.IdentifiableObject instance) long[]
getObjects
(boolean create, String errorMsgPrefix) Returns all the instances the methods will be invoked upon.static long[]
instanceHashCodes
(Object object) static IObject.IdentifiableObject[]
static IObject.IdentifiableObject[]
-
Method Details
-
getObjects
Returns all the instances the methods will be invoked upon. This will typically be an array of one object in the absence of a @Factory annotation.- Parameters:
create
- -true
if objects should be created before returning.errorMsgPrefix
- - Text that should be prefixed to the error message when there are issues. Can be empty.- Returns:
- - An array of
IObject.IdentifiableObject
objects
-
getInstanceHashCodes
long[] getInstanceHashCodes()- Returns:
- - An array representing the hash codes of the corresponding instances.
-
addObject
- Parameters:
instance
- - The instance that should be added to the list of instances.
-
instanceHashCodes
- Parameters:
object
- - The object that should be inspected for its compatibility withIObject
.- Returns:
- - An array representing the hash codes of the corresponding instances.
-
objects
- Parameters:
object
- - The object that should be inspected for its compatibility withIObject
.create
- -true
if objects should be created before returning.- Returns:
- - An array (can be empty is instance compatibility fails) of
IObject.IdentifiableObject
objects.
-
objects
- Parameters:
object
- - The object that should be inspected for its compatibility withIObject
.create
- -true
if objects should be created before returning.errorMsgPrefix
- - Text that should be prefixed to the error message when there are issues. Can be empty.- Returns:
- - An array (can be empty is instance compatibility fails) of
IObject.IdentifiableObject
objects.
-
cast
- Parameters:
object
- - The object that should be inspected for its compatibility withIObject
.- Returns:
- - If the incoming object is an instance of
IObject
then the cast instance is wrapped withinOptional
else it would be anOptional.empty()
-