Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added direct classes on all developed classes under Java.Util.Function namespace #441

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions src/net/JNet/Developed/Java/Util/Function/BiConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

using MASES.JCOBridge.C2JBridge;
using MASES.JCOBridge.C2JBridge.JVMInterop;
using System;

namespace Java.Util.Function
Expand Down Expand Up @@ -62,9 +63,12 @@ public class BiConsumerDirect : BiConsumer
/// </summary>
public override bool AutoInit => false;

/// <inheritdoc cref="Predicate.InitHandlers"/>
/// <inheritdoc />
protected override bool InitHandlers => false;

const string _bridgeClassName = "java.util.function.BiConsumer";
private static readonly IJavaType LocalBridgeClazz = ClazzOf(_bridgeClassName);

/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeListener_BridgeClassName.htm"/>
/// </summary>
Expand All @@ -85,6 +89,25 @@ public class BiConsumerDirect : BiConsumer
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeStatic.htm"/>
/// </summary>
public override bool IsBridgeStatic => false;

/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/BiConsumer.html#accept(java.lang.Object,java.lang.Object)"/>
/// </summary>
/// <param name="arg0"><see cref="object"/></param>
/// <param name="arg1"><see cref="object"/></param>
public void Accept(object arg0, object arg1)
{
IExecute("accept", arg0, arg1);
}
/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/BiConsumer.html#andThen(java.util.function.BiConsumer)"/>
/// </summary>
/// <param name="arg0"><see cref="Java.Util.Function.BiConsumer"/></param>
/// <returns><see cref="Java.Util.Function.BiConsumer"/></returns>
public Java.Util.Function.BiConsumer AndThen(Java.Util.Function.BiConsumer arg0)
{
return IExecuteWithSignature<Java.Util.Function.BiConsumerDirect, Java.Util.Function.BiConsumer>("andThen", "(Ljava/util/function/BiConsumer;)Ljava/util/function/BiConsumer;", arg0);
}
}

/// <summary>
Expand Down Expand Up @@ -131,7 +154,7 @@ public class BiConsumerDirect<T, U> : BiConsumer<T, U>
/// </summary>
public override bool AutoInit => false;

/// <inheritdoc cref="Predicate.InitHandlers"/>
/// <inheritdoc />
protected override bool InitHandlers => false;

/// <summary>
Expand All @@ -154,5 +177,27 @@ public class BiConsumerDirect<T, U> : BiConsumer<T, U>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeStatic.htm"/>
/// </summary>
public override bool IsBridgeStatic => false;

/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/BiConsumer.html#accept(java.lang.Object,java.lang.Object)"/>
/// </summary>
/// <param name="arg0"><typeparamref name="T"/></param>
/// <param name="arg1"><typeparamref name="U"/></param>
public override void Accept(T arg0, U arg1)
{
IExecute("accept", arg0, arg1);
}
/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/BiConsumer.html#andThen(java.util.function.BiConsumer)"/>
/// </summary>
/// <param name="arg0"><see cref="Java.Util.Function.BiConsumer"/></param>
/// <typeparam name="Arg0objectSuperT"><typeparamref name="T"/></typeparam>
/// <typeparam name="Arg0objectSuperU"><typeparamref name="U"/></typeparam>
/// <returns><see cref="Java.Util.Function.BiConsumer"/></returns>
public Java.Util.Function.BiConsumer<T, U> AndThen<Arg0objectSuperT, Arg0objectSuperU>(Java.Util.Function.BiConsumer<Arg0objectSuperT, Arg0objectSuperU> arg0) where Arg0objectSuperT : T where Arg0objectSuperU : U
{
return IExecuteWithSignature<Java.Util.Function.BiConsumerDirect<T, U>, Java.Util.Function.BiConsumer<T, U>>("andThen", "(Ljava/util/function/BiConsumer;)Ljava/util/function/BiConsumer;", arg0);
}

}
}
129 changes: 128 additions & 1 deletion src/net/JNet/Developed/Java/Util/Function/BiFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

using MASES.JCOBridge.C2JBridge;
using MASES.JCOBridge.C2JBridge.JVMInterop;
using System;

namespace Java.Util.Function
Expand All @@ -43,12 +44,74 @@ public interface IBiFunction<T, U, TReturn> : IJVMBridgeBase
/// </summary>
public abstract class BiFunction : JVMBridgeListener
{
/// <summary>
/// Enable/disable handlers initialization, default is <see langword="true"/>
/// </summary>
protected virtual bool InitHandlers { get; } = true;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeListener_BridgeClassName.htm"/>
/// </summary>
public override string BridgeClassName => "org.mases.jnet.developed.java.util.function.BiFunction";
}

/// <summary>
/// Direct override of <see cref="BiFunction"/> or its generic type if there is one
/// </summary>
public class BiFunctionDirect : BiFunction
{
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeListener_AutoInit.htm"/>
/// </summary>
public override bool AutoInit => false;

/// <inheritdoc />
protected override bool InitHandlers => false;

const string _bridgeClassName = "java.util.function.BiFunction";
private static readonly IJavaType LocalBridgeClazz = ClazzOf(_bridgeClassName);

/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeListener_BridgeClassName.htm"/>
/// </summary>
public override string BridgeClassName => _bridgeClassName;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeAbstract.htm"/>
/// </summary>
public override bool IsBridgeAbstract => true;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeCloseable.htm"/>
/// </summary>
public override bool IsBridgeCloseable => false;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeInterface.htm"/>
/// </summary>
public override bool IsBridgeInterface => true;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeStatic.htm"/>
/// </summary>
public override bool IsBridgeStatic => false;

/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/BiFunction.html#apply(java.lang.Object,java.lang.Object)"/>
/// </summary>
/// <param name="arg0"><see cref="object"/></param>
/// <param name="arg1"><see cref="object"/></param>
/// <returns><see cref="object"/></returns>
public object Apply(object arg0, object arg1)
{
return IExecute("apply", arg0, arg1);
}
/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/BiFunction.html#andThen(java.util.function.Function)"/>
/// </summary>
/// <param name="arg0"><see cref="Java.Util.Function.Function"/></param>
/// <returns><see cref="Java.Util.Function.BiFunction"/></returns>
public Java.Util.Function.BiFunction AndThen(Java.Util.Function.Function arg0)
{
return IExecuteWithSignature<Java.Util.Function.BiFunctionDirect, Java.Util.Function.BiFunction>("andThen", "(Ljava/util/function/Function;)Ljava/util/function/BiFunction;", arg0);
}
}

/// <summary>
/// Listener for <see href="https://docs.oracle.com/javase/8/docs/api/java/util/function/BiFunction.html"/>. Extends <see cref="BiFunction"/>
/// </summary>
Expand All @@ -66,7 +129,10 @@ public class BiFunction<T, U, TReturn> : BiFunction, IBiFunction<T, U, TReturn>
/// </summary>
public BiFunction()
{
AddEventHandler("apply", new EventHandler<CLRListenerEventArgs<CLREventData<T>>>(ApplyEventHandler)); OnApply = Apply;
if (InitHandlers)
{
AddEventHandler("apply", new EventHandler<CLRListenerEventArgs<CLREventData<T>>>(ApplyEventHandler)); OnApply = Apply;
}
}

void ApplyEventHandler(object sender, CLRListenerEventArgs<CLREventData<T>> data)
Expand All @@ -82,4 +148,65 @@ void ApplyEventHandler(object sender, CLRListenerEventArgs<CLREventData<T>> data
/// <returns>The apply <typeparamref name="TReturn"/></returns>
public virtual TReturn Apply(T o1, U o2) { return default(TReturn); }
}

/// <summary>
/// Direct override of <see cref="BiFunction"/> or its generic type if there is one
/// </summary>
public partial class BiFunctionDirect<T, U, R> : BiFunction<T, U, R>
{
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeListener_AutoInit.htm"/>
/// </summary>
public override bool AutoInit => false;

/// <inheritdoc />
protected override bool InitHandlers => false;

const string _bridgeClassName = "java.util.function.BiFunction";
private static readonly IJavaType LocalBridgeClazz = ClazzOf(_bridgeClassName);

/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeListener_BridgeClassName.htm"/>
/// </summary>
public override string BridgeClassName => _bridgeClassName;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeAbstract.htm"/>
/// </summary>
public override bool IsBridgeAbstract => true;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeCloseable.htm"/>
/// </summary>
public override bool IsBridgeCloseable => false;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeInterface.htm"/>
/// </summary>
public override bool IsBridgeInterface => true;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeStatic.htm"/>
/// </summary>
public override bool IsBridgeStatic => false;

/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/BiFunction.html#apply(java.lang.Object,java.lang.Object)"/>
/// </summary>
/// <param name="arg0"><typeparamref name="T"/></param>
/// <param name="arg1"><typeparamref name="U"/></param>
/// <returns><typeparamref name="R"/></returns>
public override R Apply(T arg0, U arg1)
{
return IExecute<R>("apply", arg0, arg1);
}
/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/function/BiFunction.html#andThen(java.util.function.Function)"/>
/// </summary>
/// <param name="arg0"><see cref="Java.Util.Function.Function"/></param>
/// <typeparam name="V"></typeparam>
/// <typeparam name="Arg0objectSuperR"><typeparamref name="R"/></typeparam>
/// <typeparam name="Arg0ExtendsV"><typeparamref name="V"/></typeparam>
/// <returns><see cref="Java.Util.Function.BiFunction"/></returns>
public Java.Util.Function.BiFunction<T, U, V> AndThen<V, Arg0objectSuperR, Arg0ExtendsV>(Java.Util.Function.Function<Arg0objectSuperR, Arg0ExtendsV> arg0) where Arg0objectSuperR : R where Arg0ExtendsV : V
{
return IExecuteWithSignature<Java.Util.Function.BiFunctionDirect<T, U, V>, Java.Util.Function.BiFunction<T, U, V>>("andThen", "(Ljava/util/function/Function;)Ljava/util/function/BiFunction;", arg0);
}
}
}
Loading