java.lang.Object
jdk.incubator.foreign.FunctionDescriptor
- All Implemented Interfaces:
- Constable
A function descriptor is made up of zero or more argument layouts and zero or one return layout. A function descriptor
 is used to model the signature of foreign functions.
 
 Unless otherwise specified, passing a null argument, or an array argument containing one or more null
 elements to a method in this class causes a NullPointerException to be thrown. 
- 
Method SummaryModifier and TypeMethodDescriptionappendArgumentLayouts(MemoryLayout... addedLayouts) Create a new function descriptor with the given argument layouts appended to the argument layout array of this function descriptor.Returns the argument layouts associated with this function descriptor.asVariadic(MemoryLayout... variadicLayouts) Obtain a specialized variadic function descriptor, by appending given variadic layouts to this function descriptor argument layouts.changeReturnLayout(MemoryLayout newReturn) Create a new function descriptor with the given memory layout as the new return layout.Create a new function descriptor with the return layout dropped.booleanCompares the specified object with this function descriptor for equality.intThe index of the first variadic argument layout (where defined).inthashCode()Returns the hash code value for this function descriptor.insertArgumentLayouts(int index, MemoryLayout... addedLayouts) Create a new function descriptor with the given argument layouts inserted at the given index, into the argument layout array of this function descriptor.static FunctionDescriptorof(MemoryLayout resLayout, MemoryLayout... argLayouts) Create a function descriptor with given return and argument layouts.static FunctionDescriptorofVoid(MemoryLayout... argLayouts) Create a function descriptor with given argument layouts and no return layout.Returns the return layout (if any) associated with this function descriptor.toString()Returns the string representation of this function descriptor.
- 
Method Details- 
returnLayoutReturns the return layout (if any) associated with this function descriptor.- Returns:
- the return layout (if any) associated with this function descriptor
 
- 
argumentLayoutsReturns the argument layouts associated with this function descriptor..- Returns:
- the argument layouts associated with this function descriptor
 
- 
ofCreate a function descriptor with given return and argument layouts.- Parameters:
- resLayout- the return layout.
- argLayouts- the argument layouts.
- Returns:
- the new function descriptor.
 
- 
ofVoidCreate a function descriptor with given argument layouts and no return layout.- Parameters:
- argLayouts- the argument layouts.
- Returns:
- the new function descriptor.
 
- 
asVariadicObtain a specialized variadic function descriptor, by appending given variadic layouts to this function descriptor argument layouts. The resulting function descriptor can report the position of the first variadic argument, and cannot be altered in any way: for instance, callingchangeReturnLayout(MemoryLayout)on the resulting descriptor will throw anUnsupportedOperationException.- Parameters:
- variadicLayouts- the variadic argument layouts to be appended to this descriptor argument layouts.
- Returns:
- a new variadic function descriptor, or this descriptor if variadicLayouts.length == 0.
 
- 
firstVariadicArgumentIndexpublic int firstVariadicArgumentIndex()The index of the first variadic argument layout (where defined).- Returns:
- The index of the first variadic argument layout, or -1if this is not a variadic layout.
 
- 
appendArgumentLayoutsCreate a new function descriptor with the given argument layouts appended to the argument layout array of this function descriptor.- Parameters:
- addedLayouts- the argument layouts to append.
- Returns:
- the new function descriptor.
 
- 
insertArgumentLayoutsCreate a new function descriptor with the given argument layouts inserted at the given index, into the argument layout array of this function descriptor.- Parameters:
- index- the index at which to insert the arguments
- addedLayouts- the argument layouts to insert at given index.
- Returns:
- the new function descriptor.
- Throws:
- IllegalArgumentException- if- index < 0 || index > argumentLayouts().size().
 
- 
changeReturnLayoutCreate a new function descriptor with the given memory layout as the new return layout.- Parameters:
- newReturn- the new return layout.
- Returns:
- the new function descriptor.
 
- 
dropReturnLayoutCreate a new function descriptor with the return layout dropped. This is useful to model functions which return no values.- Returns:
- the new function descriptor.
 
- 
toStringReturns the string representation of this function descriptor.
- 
equalsCompares the specified object with this function descriptor for equality. Returnstrueif 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 (see MemoryLayout.equals(Object))
 
- the two function descriptors have equals return layouts (see 
- 
hashCodepublic int hashCode()Returns the hash code value for this function descriptor.
- 
describeConstableReturns anOptionalcontaining the nominal descriptor for this function descriptor, if one can be constructed, or an emptyOptionalif one cannot be constructed.- Specified by:
- describeConstablein interface- Constable
- Returns:
- An Optionalcontaining the resulting nominal descriptor, or an emptyOptionalif one cannot be constructed.
 
 
-