Class DefaultArgumentsAccessor
- java.lang.Object
-
- org.junit.jupiter.params.aggregator.DefaultArgumentsAccessor
-
- All Implemented Interfaces:
ArgumentsAccessor
@API(status=INTERNAL, since="5.2") public class DefaultArgumentsAccessor extends java.lang.Object implements ArgumentsAccessorDefault implementation of theArgumentsAccessorAPI.Delegates conversion to
DefaultArgumentConverter.- Since:
- 5.2
- See Also:
ArgumentsAccessor,DefaultArgumentConverter,ParameterizedTest
-
-
Constructor Summary
Constructors Constructor Description DefaultArgumentsAccessor(java.lang.Object... arguments)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectget(int index)Get the value of the argument at the given index as anObject.<T> Tget(int index, java.lang.Class<T> requiredType)Get the value of the argument at the given index as an instance of the required type.java.lang.BooleangetBoolean(int index)Get the value of the argument at the given index as aBoolean, performing automatic type conversion as necessary.java.lang.BytegetByte(int index)Get the value of the argument at the given index as aByte, performing automatic type conversion as necessary.java.lang.CharactergetCharacter(int index)Get the value of the argument at the given index as aCharacter, performing automatic type conversion as necessary.java.lang.DoublegetDouble(int index)Get the value of the argument at the given index as aDouble, performing automatic type conversion as necessary.java.lang.FloatgetFloat(int index)Get the value of the argument at the given index as aFloat, performing automatic type conversion as necessary.java.lang.IntegergetInteger(int index)Get the value of the argument at the given index as aInteger, performing automatic type conversion as necessary.java.lang.LonggetLong(int index)Get the value of the argument at the given index as aLong, performing automatic type conversion as necessary.java.lang.ShortgetShort(int index)Get the value of the argument at the given index as aShort, performing automatic type conversion as necessary.java.lang.StringgetString(int index)Get the value of the argument at the given index as aString, performing automatic type conversion as necessary.intsize()Get the number of arguments in this accessor.java.lang.Object[]toArray()Get all arguments in this accessor as an array.java.util.List<java.lang.Object>toList()Get all arguments in this accessor as an immutable list.
-
-
-
Method Detail
-
get
public java.lang.Object get(int index)
Description copied from interface:ArgumentsAccessorGet the value of the argument at the given index as anObject.- Specified by:
getin interfaceArgumentsAccessor- Parameters:
index- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()- Returns:
- the value at the given index, potentially
null
-
get
public <T> T get(int index, java.lang.Class<T> requiredType)Description copied from interface:ArgumentsAccessorGet the value of the argument at the given index as an instance of the required type.- Specified by:
getin interfaceArgumentsAccessor- Parameters:
index- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()requiredType- the required type of the value; nevernull- Returns:
- the value at the given index, potentially
null
-
getCharacter
public java.lang.Character getCharacter(int index)
Description copied from interface:ArgumentsAccessorGet the value of the argument at the given index as aCharacter, performing automatic type conversion as necessary.- Specified by:
getCharacterin interfaceArgumentsAccessor- Parameters:
index- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()- Returns:
- the value at the given index, potentially
null
-
getBoolean
public java.lang.Boolean getBoolean(int index)
Description copied from interface:ArgumentsAccessorGet the value of the argument at the given index as aBoolean, performing automatic type conversion as necessary.- Specified by:
getBooleanin interfaceArgumentsAccessor- Parameters:
index- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()- Returns:
- the value at the given index, potentially
null
-
getByte
public java.lang.Byte getByte(int index)
Description copied from interface:ArgumentsAccessorGet the value of the argument at the given index as aByte, performing automatic type conversion as necessary.- Specified by:
getBytein interfaceArgumentsAccessor- Parameters:
index- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()- Returns:
- the value at the given index, potentially
null
-
getShort
public java.lang.Short getShort(int index)
Description copied from interface:ArgumentsAccessorGet the value of the argument at the given index as aShort, performing automatic type conversion as necessary.- Specified by:
getShortin interfaceArgumentsAccessor- Parameters:
index- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()- Returns:
- the value at the given index, potentially
null
-
getInteger
public java.lang.Integer getInteger(int index)
Description copied from interface:ArgumentsAccessorGet the value of the argument at the given index as aInteger, performing automatic type conversion as necessary.- Specified by:
getIntegerin interfaceArgumentsAccessor- Parameters:
index- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()- Returns:
- the value at the given index, potentially
null
-
getLong
public java.lang.Long getLong(int index)
Description copied from interface:ArgumentsAccessorGet the value of the argument at the given index as aLong, performing automatic type conversion as necessary.- Specified by:
getLongin interfaceArgumentsAccessor- Parameters:
index- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()- Returns:
- the value at the given index, potentially
null
-
getFloat
public java.lang.Float getFloat(int index)
Description copied from interface:ArgumentsAccessorGet the value of the argument at the given index as aFloat, performing automatic type conversion as necessary.- Specified by:
getFloatin interfaceArgumentsAccessor- Parameters:
index- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()- Returns:
- the value at the given index, potentially
null
-
getDouble
public java.lang.Double getDouble(int index)
Description copied from interface:ArgumentsAccessorGet the value of the argument at the given index as aDouble, performing automatic type conversion as necessary.- Specified by:
getDoublein interfaceArgumentsAccessor- Parameters:
index- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()- Returns:
- the value at the given index, potentially
null
-
getString
public java.lang.String getString(int index)
Description copied from interface:ArgumentsAccessorGet the value of the argument at the given index as aString, performing automatic type conversion as necessary.- Specified by:
getStringin interfaceArgumentsAccessor- Parameters:
index- the index of the argument to get; must be greater than or equal to zero and less thanArgumentsAccessor.size()- Returns:
- the value at the given index, potentially
null
-
size
public int size()
Description copied from interface:ArgumentsAccessorGet the number of arguments in this accessor.- Specified by:
sizein interfaceArgumentsAccessor
-
toArray
public java.lang.Object[] toArray()
Description copied from interface:ArgumentsAccessorGet all arguments in this accessor as an array.- Specified by:
toArrayin interfaceArgumentsAccessor
-
toList
public java.util.List<java.lang.Object> toList()
Description copied from interface:ArgumentsAccessorGet all arguments in this accessor as an immutable list.- Specified by:
toListin interfaceArgumentsAccessor
-
-