Class JNetCoreExtensions
- Namespace
- MASES.JNet.Specific.Extensions
- Assembly
- MASES.JNet.dll
Extension class
public static class JNetCoreExtensions
- Inheritance
-
JNetCoreExtensions
- Inherited Members
Methods
Class<TClass>(TClass)
Retrieve the Class<T> from the TClass
public static Class<TClass> Class<TClass>(this TClass _) where TClass : IJVMBridgeBase, new()
Parameters
_
TClass
Returns
Type Parameters
TClass
A class extending MASES.JCOBridge.C2JBridge.IJVMBridgeBase
DirectBufferWithWrap<TData, TWrap>(TData[], bool, bool, int, Func<ByteBuffer, TWrap>)
The method creates a ByteBuffer and wrap it into TWrap
public static TWrap DirectBufferWithWrap<TData, TWrap>(this TData[] data, bool useMemoryControlBlock = true, bool arrangeCapacity = true, int timeToLive = -1, Func<ByteBuffer, TWrap> converter = null) where TWrap : IJVMBridgeBase, new()
Parameters
data
TData[]The array of
TData
to be wrappeduseMemoryControlBlock
boolAppends to the end of the
data
a memory block will be used to controls and arbitrates memory between CLR and JVMarrangeCapacity
boolIf true the
TData
array indata
will be resized to the next power of 2, so capacity will be memory aligned and the limit of java.nio.ByteBuffer will be current size ofdata
timeToLive
intThe time to live, expressed in milliseconds, the underlying memory shall remain available; if the time to live expires the pinned memory is retired leaving potentially the JVM under the possibility of an access violation.
converter
Func<ByteBuffer, TWrap>A Func<T, TResult> that receives the prepared ByteBuffer and shall return
TWrap
Returns
- TWrap
The
TWrap
instance
Type Parameters
TData
The data to be wrapped
TWrap
The wrapping class
GetStaticPropertyOn(Type, Type, string)
Generic static property getter
public static object GetStaticPropertyOn(this Type origin, Type target, string propertyName)
Parameters
origin
TypeThe origin
target
TypeThe target Type where the static property was defined
propertyName
stringThe property name
Returns
- object
The property value
GetStaticPropertyOn<TContainingClass>(Type, string)
Generic static property getter
public static object GetStaticPropertyOn<TContainingClass>(this Type origin, string propertyName)
Parameters
Returns
- object
The property value
Type Parameters
TContainingClass
The target Type where the static property was defined
RunStaticMethodOn(Type, Type, string, params object[])
Executes a static method defined in destination
public static object RunStaticMethodOn(this Type origin, Type destination, string methodName, params object[] args)
Parameters
origin
TypeThe origin
destination
TypeThe target Type where the static method was defined
methodName
stringThe method name
args
object[]The method arguments
Returns
- object
The method result
RunStaticMethodOn(Type, Type, string, Type[], params object[])
Executes a static method defined in destination
public static object RunStaticMethodOn(this Type origin, Type destination, string methodName, Type[] types, params object[] args)
Parameters
origin
TypeThe origin
destination
TypeThe target Type where the static method was defined
methodName
stringThe method name
types
Type[]The Type of the arguments
args
object[]The method arguments
Returns
- object
The method result
RunStaticMethodOn<TContainingClass>(Type, string, params object[])
Executes a static method defined in source
public static object RunStaticMethodOn<TContainingClass>(this Type source, string methodName, params object[] args)
Parameters
Returns
- object
The method result
Type Parameters
TContainingClass
The target Type where the static method was defined
SetStaticPropertyOn(Type, Type, string, object)
Generic static property setter
public static void SetStaticPropertyOn(this Type origin, Type destination, string propertyName, object value)
Parameters
origin
TypeThe origin
destination
TypeThe target Type where the static property was defined
propertyName
stringThe property name
value
objectThe property value
SetStaticPropertyOn<TContainingClass>(Type, string, object)
Generic static property setter
public static void SetStaticPropertyOn<TContainingClass>(this Type origin, string propertyName, object value)
Parameters
Type Parameters
TContainingClass
The target Type where the static property was defined
TraverseUntil(Type, Type)
Traverse the class chain from source
until t
public static Type TraverseUntil(this Type source, Type t)