Package sc.obj

Enum SyncMode

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

    public enum SyncMode
    extends java.lang.Enum<SyncMode>
    Represents the various sync modes for a given class or property. It can be enabled, disabled, set to automatic, enabled only for one direction - client to server or server to client, or restored to it's default value. When you set the SyncMode to Automatic, any objects that exist in more than one runtime are synchronized in those runtimes automatically. Essentially overlapping types and properties are given the @Sync(syncMode=SyncMode.Enabled) annotation by default so that the two runtimes are properly synchronized. The code-generation phase looks at which properties have initializers to determine the sync behavior. When a property has a forward binding expression only, it's value is not synchronized since it's computed from other properties. When it's initialized on the client and server, its initDefault flag is set to false. When it only exists in one runtime, it's not synchronized at all.

    The SyncMode is inherited by a subclass unless the subclass sets SyncMode itself. In that case, the SyncMode of the base class is used for all properties in the base class and the SyncMode on the subclass is used only for those fields/properties added by the subclass.

    If the SyncMode is not set on a class at all, the SyncMode of the layer is used if one is set in the layer definition file.

    In some cases you may want to explicitly enable or disable synchronization for a class, but then allow the layer's sync mode to determine whether subclasses of a particular class should synchronize fields in the subclass. In this case, setting SyncMode to Default causes us to check the SyncMode of the layer and use that instead of the mode inherited from the subclass. For example, for the Element class, we disable synchronization. But for any subclasses of HtmlPage, we want to use the layer's syncMode if it's set. In that case, we set SyncMode=Default on HtmlPage.

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      Automatic
      Sync on only for overlapping types/properties in the client and server runtimes - i.e.
      ClientToServer
      Send changes from client to server only or server to client only
      Default
      Use the sync mode from the layer definition file of the type or property.
      Disabled
      Sync mode is off for this type or property
      Enabled
      Sync mode is on for this type or property
      ServerToClient  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static SyncMode valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static SyncMode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • Enabled

        public static final SyncMode Enabled
        Sync mode is on for this type or property
      • Disabled

        public static final SyncMode Disabled
        Sync mode is off for this type or property
      • Automatic

        public static final SyncMode Automatic
        Sync on only for overlapping types/properties in the client and server runtimes - i.e. where the definition exists in layers included in both runtimes.
      • ClientToServer

        public static final SyncMode ClientToServer
        Send changes from client to server only or server to client only
      • ServerToClient

        public static final SyncMode ServerToClient
      • Default

        public static final SyncMode Default
        Use the sync mode from the layer definition file of the type or property. Allows framework classes to define sync behavior in base classes, then revert to the layer's sync mode for any subclass sync behavior.
    • Method Detail

      • values

        public static SyncMode[] 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 (SyncMode c : SyncMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static SyncMode 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