Interface TunablePropertySerializer

  • public interface TunablePropertySerializer
    This is a type of tunable interceptor that converts the values annotated with Tunable annotations to and from a Properties object. The generated Properties can be used with CyProperty<Properties> to save the values.

     public class Foo {
         @Tunable public int x = 5;
     public class Bar {
         @ContainsTunables public Foo foo = new Foo();
         @Tunable public int y = 10;
     Properties props = tunablePropertySerializer.toProperties(new Bar());
    Produces the following key/value pairs:
    Values are converted to and from Strings using available TunablePropertyHandlers. By default the following types are supported:
    • "Basic" types
      • Strings
      • Enums
      • primitive types (eg: int, double)
      • wrappers for primitive types (eg: java.lang.Integer, java.lang.Double)
    • ListSingleSelection<T> where T is a Basic type
    • ListMultipleSelection<T> where T is a Basic type
    • BoundedFloat
    • BoundedDouble
    • BoundedInteger
    • BoundedLong
    Support for additional types can be provided by registering a TunablePropertyHandlerFactory OSGi service.

    Note: Implementations of this interface are typically not thread safe. Use TunablePropertySerializerFactory to create thread-local instances.

    Module: work-api

    To use this in your app, include the following dependency in your POM:


    Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
    • Method Detail

      • setTunables

        void setTunables​(Object objectWithTunables,
                         Properties properties)
        Takes the properties and applies them to the tunables in the object. Each property is converted from a String into a value of the type of the tunable. A TunablePropertyHandler of the appropriate type must be available.
        objectWithTunables - Object with @Tunable annotations.
        properties - Properties object.
        IllegalArgumentException - If any of the property values cannot be parsed or contain an illegal value.
      • toProperties

        Properties toProperties​(Object objectWithTunables)
        Returns a Properties object where each property key is a qualified field name and the property value is the result of applying a TunablePropertyHandler to the tunable value.
        objectWithTunables - Object with @Tunable annotations.
        Properties object.