Packagecom.yworks.support
Interfacepublic interface IEnum
Implementors AdjustContentRectPolicy, BridgeUpdateMode, EdgeLayerPolicy, LabelLayerPolicy, PortLayerPolicy, ReparentGesture, StripeSubregion, StripeVisualizationType, TableRenderingOrder

Tagging interface for enum classes that should be serialized automatically using the ReflectionBasedSerializer

In order to support automatic deserialization, a static method valueOf(s:String):IEnum has to be provided by the enum class.

Also, a toString() implementation has to be provided, such that enumValue == EnumClass.valueOf( enumValue.toString() );

View the examples

See also

com.yworks.io.graphml.writer.serializer.ReflectionBasedSerializer


Examples
An example IEnum implementation:
 public class LayoutStyle implements IEnum {
 
       public static const BCC_COMPACT:LayoutStyle = new LayoutStyle("bccCompact");
       public static const BCC_ISOLATED:LayoutStyle = new LayoutStyle("bccIsolated");
       public static const CIRCULAR_CUSTOM_GROUPS:LayoutStyle = new LayoutStyle("circularCustomGroups");
       public static const SINGLE_CYCLE:LayoutStyle = new LayoutStyle("singleCycle");
       private static const values:Array = [
           BCC_COMPACT,
           BCC_ISOLATED,
           CIRCULAR_CUSTOM_GROUPS,
           SINGLE_CYCLE
       ];
       private var _name:String;
 
       public function LayoutStyle(name:String) {
           this._name = name
       }
 
       public function toString():String {
           return this._name
       }
 
       public static function valueOf(s:Object):LayoutStyle {
           if (s != null) {
               for (var i:int = 0; i %lt; values.length; i++) {
                   if (values[i].toString() == s) {
                       return values[i];
                   }
               }
           }
           throw new ArgumentError("Invalid enum value: " + s);
       }
   }