com.yworks.yfiles.server.graphml.support
Interface IEnum

All Known Implementing Classes:
TableRenderingOrder

public interface IEnum

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

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

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

An example IEnum implementation:

 ;
       private String name;


       public static LayoutStyle valueOf(String s) {
           if (s != null) {
               for (int i = 0; i < values.length; i++) {
                   if (values[i].toString().equals(s)) {
                       return values[i];
                   }
               }
           }
           throw new IllegalArgumentException("Invalid enum value: " + s);
       }

       private LayoutStyle(String name) {
           this.name = name;
       }

       public String toString() {
           return this.name;
       }
 }
 }
 

See Also:
ReflectionBasedSerializer, ReflectionBasedDeserializer



Copyright © 2000-2013 yWorks GmbH. All rights reserved