com.javonet.api

Class NEnum

  • java.lang.Object
    • com.javonet.api.NEnum

  • public class NEnum
    extends java.lang.Object
    A handle to .NET enum type value.

    This class represents .NET enum type value loaded on .NET side.

    NEnum initialization

    NEnum is initialized by calling it’s constructor and providing enum type full name and selected value.

    NEnum maximizedValue = new NEnum("System.Windows.Forms.FormWindowState","Maximized")

    NEnum Usage Sample

                    NObject form = Javonet.New("Form");
                    form.set("Text", "Dynamic .NET Window Created By Javonet");
                    form.set("WindowState", new NEnum("System.Windows.Forms.FormWindowState","Maximized"));
     
    Version:
    1.0


    • Constructor Summary

      Constructors 
      Constructor and Description
      NEnum(java.lang.Enum<?> enumValue)

      Creates new instance of NEnum based on Java enum.
      NEnum(java.lang.String enumName,
      java.lang.String valueName)

      Creates new instance of NEnum associated to specified enum type and selected value
      NEnum(java.lang.String enumName,
      java.lang.String valueName,
      java.lang.Integer value)

      Creates new instance of NEnum associated to specified enum type and selected value name and value



    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean equals(java.lang.Object other)

      Since version: 1.1

      Compares this NEnum with another NEnum instance.

      static NEnum fromJavaEnum(java.lang.Enum<?> enumValue)

      Creates new instance of NEnum based on Java enum.
      java.lang.String getEnumName()

      Returns name of loaded enum type.
      java.lang.Integer getValue()

      Returns value of loaded enum type value.
      java.lang.String getValueName()

      Returns value name of loaded enum type value.
      void setValue(java.lang.String valueName,
      java.lang.Integer value)

      Replaces initially assigned Enum value.


      • Methods inherited from class java.lang.Object

        getClass, hashCode, notify, notifyAll, toString, wait, wait, wait



    • Constructor Detail



      • NEnum

        public NEnum(java.lang.Enum<?> enumValue)
        Creates new instance of NEnum based on Java enum.

        This constructor should be used in case when .NET enums are replicated on Java side
        for usability purposes and strongly-typed wrappers.

        The method takes the Java Enum package name and Enum name and its value
        assuming that corresponding enum existing on .NET side.

        In example for Java enum:

         
         package MyApp.Commons;
         enum MyEnum {
         	One,
         	Two,
         	Three
         }
         
         

        The constructor will initialize the new NEnum instance where:
        Name = MyApp.Commons.MyEnum
        Value = i.e. One

        Parameters:
        enumValue – Value of Java enum
        Since:
        1.5



      • NEnum

        public NEnum(java.lang.String enumName,
                     java.lang.String valueName)
        Creates new instance of NEnum associated to specified enum type and selected value
        Parameters:
        enumName – Full name of enum type
        valueName – Name of enum value



      • NEnum

        public NEnum(java.lang.String enumName,
                     java.lang.String valueName,
                     java.lang.Integer value)
        Creates new instance of NEnum associated to specified enum type and selected value name and value
        Parameters:
        enumName – Full name of enum type
        valueName – Name of enum value
        value – Value of enum value



    • Method Detail



      • equals

        public boolean equals(java.lang.Object other)
        Since version: 1.1

        Compares this NEnum with another NEnum instance. If both points to the same .NET
        enum type and value this method returns true, otherwise false.

        Overrides:
        equals in class java.lang.Object
        Parameters:
        other – NEnum object to be compared



      • fromJavaEnum

        public static NEnum fromJavaEnum(java.lang.Enum<?> enumValue)
        Creates new instance of NEnum based on Java enum.

        This method should be used in case when .NET enums are replicated on Java side
        for usability purposes and strongly-typed wrappers.

        The method takes the Java Enum package name and Enum name and its value
        assuming that corresponding enum existing on .NET side.

        In example for Java enum:

         
         package MyApp.Commons;
         enum MyEnum {
         	One,
         	Two,
         	Three
         }
         
         

        The method will initialize the new NEnum instance where:
        Name = MyApp.Commons.MyEnum
        Value = i.e. One

        Parameters:
        enumValue – Value of Java enum
        Since:
        1.5



      • getEnumName

        public java.lang.String getEnumName()
        Returns name of loaded enum type.
        Returns:
        Name of loaded enum type



      • getValue

        public java.lang.Integer getValue()
        Returns value of loaded enum type value.
        Returns:
        Value of loaded enum type value



      • getValueName

        public java.lang.String getValueName()
        Returns value name of loaded enum type value.
        Returns:
        Value name of loaded enum type value



      • setValue

        public void setValue(java.lang.String valueName,
                             java.lang.Integer value)
        Replaces initially assigned Enum value. Provided “valueName” and “value” must match
        the .NET enum definition.
        Parameters:
        valueName – Name of the new value to be assigned
        value – Integer value of new value to be assigned