public interface TunablePropertySerializer
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:
foo.x=5
y=10
Values are converted to and from Strings using available TunablePropertyHandler
s.
By default the following types are supported:
TunablePropertyHandlerFactory
OSGi service.
TunablePropertySerializerFactory
to create thread-local instances.
Module: work-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>work-api</artifactId> </dependency>
Modifier and Type | Method and Description |
---|---|
void |
setTunables(Object objectWithTunables,
Properties properties)
Takes the properties and applies them to the tunables in the object.
|
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. |
void setTunables(Object objectWithTunables, Properties properties)
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.Properties toProperties(Object objectWithTunables)
TunablePropertyHandler
to the tunable value.objectWithTunables
- Object with @Tunable annotations.Copyright 2011-2015 Cytoscape Consortium. All rights reserved.