APIs for Java Developers

Go to APIs for .NET Developers

com.javonet

Enum JavonetApartmentState

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<JavonetApartmentState>

    public enum JavonetApartmentState
    extends java.lang.Enum<JavonetApartmentState>
    Enum that specifies possible apartments states to be used for main thread
    initialized on .NET side.

    Javonet during initialization creates .NET process connected to JAVA process of your
    application. The .NET process main thread can be in Multi-Threaded Apartment state
    or Single-Threaded Apartment state. This value is very important for implementations
    where WinForms or WPF interface is supposed to be used for JAVA application.

    In case when you plan to create WinForms or WPF interface you must use STA apartment thread.

    Important: STA mode is supported only in .NET Framework 4.0 or 4.5 mode. For .NET 3.5 DLLs
    which require STA mode please load .NET Framework 4.0 or higher.

    Usage Sample

    Apartment state must be set before any other Javonet operation is called. It can be specified
    by calling Javonet.setApartmentState(JavonetApartmentState) method or using Javonet
    XML configuration file; for example

      
     <?xml version="1.0" encoding="ISO-8859-1" ?>
     <javonet>
    	<activation>
    		<email>your@mail.com</email>
    		<licencekey>your-javonet-license-key</licencekey>
    	</activation>
    	<references>
    		<reference>System.Windows.Forms</reference>
    		<reference>System.Drawing</reference>
    	</references>
    	<settings>
    		<apartmentState>STA</apartmentState>
    		<framework>v35</framework>
    	</settings>
     </javonet>
     
     


    • Enum Constant Summary

      Enum Constants 
      Enum Constant and Description
      MTA

      The Thread will create and enter a multi-threaded apartment.
      STA

      The Thread will create and enter a single-threaded apartment.



    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static JavonetApartmentState valueOf(java.lang.String name)

      Returns the enum constant of this type with the specified name.
      static JavonetApartmentState[] values()

      Returns an array containing the constants of this enum type, in
      the order they are declared.


      • Methods inherited from class java.lang.Enum

        compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf



      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait



    • Enum Constant Detail



      • MTA

        public static final JavonetApartmentState MTA
        The Thread will create and enter a multi-threaded apartment.



      • STA

        public static final JavonetApartmentState STA
        The Thread will create and enter a single-threaded apartment.



    • Method Detail



      • valueOf

        public static JavonetApartmentState valueOf(java.lang.String name)
        Returns the enum constant of this type with the specified name.
        The string must match exactly an identifier used to declare an
        enum constant in this type. (Extraneous whitespace characters are
        not permitted.)
        Parameters:
        name – the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException – if this enum type has no constant with the specified name
        java.lang.NullPointerException – if the argument is null



      • values

        public static JavonetApartmentState[] values()
        Returns an array containing the constants of this enum type, in
        the order they are declared. This method may be used to iterate
        over the constants as follows:

        for (JavonetApartmentState c : JavonetApartmentState.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared