diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-02-27 16:08:54 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-02-27 16:08:54 +0100 |
commit | c58c649531e4884a92f07d9b12f0ad77fbcf5d6a (patch) | |
tree | 38d2997ec6cdaed9120dba012b61afbb8b2e53ea /same/src/main/java/com/orbekk/same/VariableFactory.java | |
parent | ee51a98e9b61336610d667de57a8cff70d0ac1d9 (diff) |
Clean up source code.
Clean up source code with Eclipse. In particular remove tabs.
Diffstat (limited to 'same/src/main/java/com/orbekk/same/VariableFactory.java')
-rw-r--r-- | same/src/main/java/com/orbekk/same/VariableFactory.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/same/src/main/java/com/orbekk/same/VariableFactory.java b/same/src/main/java/com/orbekk/same/VariableFactory.java index 3f3b19c..f1796d6 100644 --- a/same/src/main/java/com/orbekk/same/VariableFactory.java +++ b/same/src/main/java/com/orbekk/same/VariableFactory.java @@ -18,14 +18,14 @@ public class VariableFactory { private Logger logger = LoggerFactory.getLogger(getClass()); private ClientInterface client; private ObjectMapper mapper = new ObjectMapper(); - + private class VariableImpl<T> implements Variable<T>, StateChangedListener { String identifier; TypeReference<T> type; T value; long revision = 0; OnChangeListener<T> listener = null; - + public VariableImpl(String identifier, TypeReference<T> type) { this.identifier = identifier; this.type = type; @@ -41,7 +41,7 @@ public class VariableFactory { try { String serializedValue = mapper.writeValueAsString(value); State.Component update = new State.Component(identifier, - revision, serializedValue); + revision, serializedValue); client.set(update); } catch (JsonGenerationException e) { logger.warn("Failed to convert to JSON: {}", value); @@ -78,22 +78,22 @@ public class VariableFactory { } } } - + public static VariableFactory create(ClientInterface client) { return new VariableFactory(client); } - + VariableFactory(ClientInterface client) { this.client = client; } - + public <T> Variable<T> create(String identifier, TypeReference<T> type) { VariableImpl<T> variable = new VariableImpl<T>(identifier, type); variable.update(); client.addStateListener(variable); return variable; } - + public Variable<String> createString(String identifier) { return create(identifier, new TypeReference<String>() {}); } |