Package org.openhab.persistence.sense.internal

Source Code of org.openhab.persistence.sense.internal.SenseEventTransformer

/**
* Copyright (c) 2010-2014, openHAB.org and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.openhab.persistence.sense.internal;

import flexjson.JSONContext;
import flexjson.transformer.AbstractTransformer;


/**
* This class defines what kind of content should be written for a {@link SenseEventBean}.
*
* @author Kai Kreuzer
* @since 1.0.0
*/
public class SenseEventTransformer extends AbstractTransformer {

  public void transform(Object obj) {
    if (obj instanceof SenseEventBean) {
      SenseEventBean senseEventBean = (SenseEventBean) obj;
      JSONContext context = getContext();
      context.writeOpenObject();
      context.writeName("feed_id");
      context.write("" + senseEventBean.getFeedId());
      context.writeComma();
      context.writeName("value");
      context.write("\"" + senseEventBean.getValue() + "\"");
      context.writeCloseObject();
    }
  }

}
TOP

Related Classes of org.openhab.persistence.sense.internal.SenseEventTransformer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.