APIs for Java Developers
Go to APIs for .NET Developers (coming soon)com.javonet.api
Class NNull
- java.lang.Object
-
- com.javonet.api.NNull
-
public class NNull extends java.lang.Object
A class that represents type specific NULL value.This class should be used in case when ambiguous invocation error occurs. Or when you want to pass as value null of specific .NET type.
Ambiguous invocation error can occur if there is more then one method on .NET side with the same method name and the same number of class type parameters and you want to invoce one of them passing null values as parameters. In this case .NET is not able to determine which method to invoce unless type-specific NULL is provided.
Usage
On .NET side
MethodA(ClassA arg1, ClassB arg2) MethodB(ClassC arg1, ClassD arg2);
How to invoke MethodA passing null values as parameters from JAVA using Javonet type-specific NULL value:
obj.MethodA(new NNull("ClassA"),new NNull("ClassB"));
.NET equivalent:
obj.MethodA((ClassA)null,(ClassB)null);
- Version:
- 1.1
-
Constructor Summary
Constructors Constructor and Description NNull(NType type)
Creates new instance of type-specific NULL value using NType.NNull(java.lang.String typeName)
Creates new instance of type-specific NULL value using type name in string.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description boolean
equals(java.lang.Object obj)
NType
getType()
Returns NType object associated with .NET type representing this NULL value.java.lang.String
getTypeName()
Returns type name of this type specific NULL value.int
hashCode()
-
Constructor Detail
-
NNull
public NNull(NType type)
Creates new instance of type-specific NULL value using NType.- Parameters:
typeName
– NType of type to which null value should be casted on .NET side (yourType)null;
-
NNull
public NNull(java.lang.String typeName)
Creates new instance of type-specific NULL value using type name in string.- Parameters:
typeName
– Type name or Full type name with namespace of type to which null value should be casted on .NET side (yourType)null;
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getType
public NType getType()
Returns NType object associated with .NET type representing this NULL value.- Returns:
- NType object associated with .NET type representing this NULL value.
-
getTypeName
public java.lang.String getTypeName()
Returns type name of this type specific NULL value.- Returns:
- Type name or Full type name with namespaces
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-