APIdia Launch Partner
Top Fields Constructors Methods
jdk.internal.foreign

public final Class FunctionDescriptorImpl

extends Object
implements FunctionDescriptor
Class Inheritance
All Implemented Interfaces
java.lang.foreign.FunctionDescriptor
Annotations
@ValueBased
Imports
jdk.internal.ValueBased, java.lang.foreign.FunctionDescriptor, .GroupLayout, .MemoryLayout, .MemorySegment, .PaddingLayout, .SequenceLayout, .ValueLayout, java.lang.invoke.MethodType, java.util.ArrayList, .List, .Objects, .Optional, java.util.stream.Collectors

Implementation Specification

This class and its subclasses are immutable, thread-safe and value-based.

Field Summary

Modifier and TypeField and Description
private final List<MemoryLayout>
private final MemoryLayout

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public FunctionDescriptorImpl

Returns:

the new function descriptor.
appendArgumentLayouts
(MemoryLayout...
the argument layouts to append.
addedLayouts
)

Implements java.lang.foreign.FunctionDescriptor.appendArgumentLayouts.

Returns a function descriptor with the given argument layouts appended to the argument layout array of this function descriptor.

public List<MemoryLayout>

Returns:

the argument layouts associated with this function descriptor (as an immutable list)
argumentLayouts
()

Implements java.lang.foreign.FunctionDescriptor.argumentLayouts.

Returns the argument layouts associated with this function descriptor (as an immutable list).

private static Class<?>
public FunctionDescriptorImpl

Returns:

the new function descriptor.
changeReturnLayout
(MemoryLayout
the new return layout.
newReturn
)

Implements java.lang.foreign.FunctionDescriptor.changeReturnLayout.

Returns a function descriptor with the given memory layout as the new return layout.

public FunctionDescriptorImpl

Returns:

the new function descriptor.
dropReturnLayout
()

Implements java.lang.foreign.FunctionDescriptor.dropReturnLayout.

Returns a function descriptor with the return layout dropped.

public boolean

Returns:

true if the specified object is equal to this function descriptor.
equals
(Object
the object to be compared for equality with this function descriptor.
other
)

Overrides java.lang.Object.equals.

Compares the specified object with this function descriptor for equality.

public int

Returns:

the hash code value for this function descriptor
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this function descriptor.

public FunctionDescriptorImpl

Returns:

the new function descriptor.
insertArgumentLayouts
(int
the index at which to insert the arguments
index
,
MemoryLayout...
the argument layouts to insert at given index.
addedLayouts
)

Implements java.lang.foreign.FunctionDescriptor.insertArgumentLayouts.

Returns a function descriptor with the given argument layouts inserted at the given index, into the argument layout array of this function descriptor.

public static FunctionDescriptor
of(MemoryLayout resLayout, List<MemoryLayout> argLayouts)

public static FunctionDescriptor
ofVoid(List<MemoryLayout> argLayouts)

public Optional<MemoryLayout>

Returns:

the return layout (if any) associated with this function descriptor
returnLayout
()

Implements java.lang.foreign.FunctionDescriptor.returnLayout.

Returns the return layout (if any) associated with this function descriptor.

public MethodType
toMethodType()

Implements java.lang.foreign.FunctionDescriptor.toMethodType.

Returns the method type consisting of the carrier types of the layouts in this function descriptor.

public String

Returns:

the string representation of this function descriptor
toString
()

Overrides java.lang.Object.toString.

Returns the string representation of this function descriptor.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

argLayoutsback to summary
private final List<MemoryLayout> argLayouts
resLayoutback to summary
private final MemoryLayout resLayout

Constructor Detail

FunctionDescriptorImplback to summary
private FunctionDescriptorImpl(MemoryLayout resLayout, List<MemoryLayout> argLayouts)

Method Detail

appendArgumentLayoutsback to summary
public FunctionDescriptorImpl appendArgumentLayouts(MemoryLayout... addedLayouts)

Implements java.lang.foreign.FunctionDescriptor.appendArgumentLayouts.

Returns a function descriptor with the given argument layouts appended to the argument layout array of this function descriptor.

Parameters
addedLayouts:MemoryLayout[]

the argument layouts to append.

Returns:FunctionDescriptorImpl

the new function descriptor.

argumentLayoutsback to summary
public List<MemoryLayout> argumentLayouts()

Implements java.lang.foreign.FunctionDescriptor.argumentLayouts.

Returns the argument layouts associated with this function descriptor (as an immutable list). .

Returns:List<MemoryLayout>

the argument layouts associated with this function descriptor (as an immutable list)

carrierTypeForback to summary
private static Class<?> carrierTypeFor(MemoryLayout layout)
changeReturnLayoutback to summary
public FunctionDescriptorImpl changeReturnLayout(MemoryLayout newReturn)

Implements java.lang.foreign.FunctionDescriptor.changeReturnLayout.

Returns a function descriptor with the given memory layout as the new return layout.

Parameters
newReturn:MemoryLayout

the new return layout.

Returns:FunctionDescriptorImpl

the new function descriptor.

dropReturnLayoutback to summary
public FunctionDescriptorImpl dropReturnLayout()

Implements java.lang.foreign.FunctionDescriptor.dropReturnLayout.

Returns a function descriptor with the return layout dropped. This is useful to model functions which return no values.

Returns:FunctionDescriptorImpl

the new function descriptor.

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Compares the specified object with this function descriptor for equality. Returns true if and only if the specified object is also a function descriptor, and all the following conditions are met:

  • the two function descriptors have equals return layouts (see MemoryLayout#equals(Object)), or both have no return layout;
  • the two function descriptors have argument layouts that are pair-wise equal; and
Parameters
other:Object

the object to be compared for equality with this function descriptor.

Returns:boolean

true if the specified object is equal to this function descriptor.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this function descriptor.

Returns:int

the hash code value for this function descriptor

Annotations
@Override
insertArgumentLayoutsback to summary
public FunctionDescriptorImpl insertArgumentLayouts(int index, MemoryLayout... addedLayouts)

Implements java.lang.foreign.FunctionDescriptor.insertArgumentLayouts.

Returns a function descriptor with the given argument layouts inserted at the given index, into the argument layout array of this function descriptor.

Parameters
index:int

the index at which to insert the arguments

addedLayouts:MemoryLayout[]

the argument layouts to insert at given index.

Returns:FunctionDescriptorImpl

the new function descriptor.

Exceptions
IllegalArgumentException:
if index < 0 || index > argumentLayouts().size().
ofback to summary
public static FunctionDescriptor of(MemoryLayout resLayout, List<MemoryLayout> argLayouts)
ofVoidback to summary
public static FunctionDescriptor ofVoid(List<MemoryLayout> argLayouts)
returnLayoutback to summary
public Optional<MemoryLayout> returnLayout()

Implements java.lang.foreign.FunctionDescriptor.returnLayout.

Returns the return layout (if any) associated with this function descriptor.

Returns:Optional<MemoryLayout>

the return layout (if any) associated with this function descriptor

toMethodTypeback to summary
public MethodType toMethodType()

Implements java.lang.foreign.FunctionDescriptor.toMethodType.

Doc from java.lang.foreign.FunctionDescriptor.toMethodType.

Returns the method type consisting of the carrier types of the layouts in this function descriptor.

The carrier type of a layout L is determined as follows:

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns the string representation of this function descriptor.

Returns:String

the string representation of this function descriptor

Annotations
@Override