Class ArrayFactory
- java.lang.Object
-
- net.bytebuddy.implementation.bytecode.collection.ArrayFactory
-
- All Implemented Interfaces:
CollectionFactory
public class ArrayFactory extends java.lang.Object implements CollectionFactory
ACollectionFactorythat is capable of creating an array of a given type with any number of given values.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceArrayFactory.ArrayCreatorAn array creator is responsible for providing correct byte code instructions for creating an array and for storing values into it.protected classArrayFactory.ArrayStackManipulationA stack manipulation for creating an array as defined by the enclosing array factory.
-
Constructor Summary
Constructors Modifier Constructor Description protectedArrayFactory(TypeDescription.Generic componentType, ArrayFactory.ArrayCreator arrayCreator)Creates a new array factory with a givenArrayFactory.ArrayCreatorwithout inferring the type from the component type.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ArrayFactoryforType(TypeDescription.Generic componentType)Creates a new array factory for a given component type.TypeDescription.GenericgetComponentType()The component type of this factory.StackManipulationwithValues(java.util.List<? extends StackManipulation> stackManipulations)Applies this collection factory in order to build a new collection where each element is represented by the given stack manipulations.
-
-
-
Constructor Detail
-
ArrayFactory
protected ArrayFactory(TypeDescription.Generic componentType, ArrayFactory.ArrayCreator arrayCreator)
Creates a new array factory with a givenArrayFactory.ArrayCreatorwithout inferring the type from the component type. Normally,forType(net.bytebuddy.description.type.TypeDescription.Generic)should be used.- Parameters:
componentType- The component type of the array factory.arrayCreator- The array creator responsible for providing the correct byte code instructions.
-
-
Method Detail
-
forType
public static ArrayFactory forType(TypeDescription.Generic componentType)
Creates a new array factory for a given component type.- Parameters:
componentType- The component type of the array that is to be build.- Returns:
- A new array factory for the given type.
-
withValues
public StackManipulation withValues(java.util.List<? extends StackManipulation> stackManipulations)
Description copied from interface:CollectionFactoryApplies this collection factory in order to build a new collection where each element is represented by the given stack manipulations.- Specified by:
withValuesin interfaceCollectionFactory- Parameters:
stackManipulations- A list of stack manipulations loading the values to be stored in the collection that is created by this factory in their given order.- Returns:
- A stack manipulation that creates the collection represented by this collection factory.
-
getComponentType
public TypeDescription.Generic getComponentType()
Description copied from interface:CollectionFactoryThe component type of this factory.- Specified by:
getComponentTypein interfaceCollectionFactory- Returns:
- A type description of this factory's component type.
-
-