All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.hapjava.services.impl.AbstractServiceImpl Maven / Gradle / Ivy

There is a newer version: 2.0.7
Show newest version
package io.github.hapjava.services.impl;

import io.github.hapjava.characteristics.Characteristic;
import io.github.hapjava.services.Service;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

abstract class AbstractServiceImpl implements Service {
  private final String type;
  private final List characteristics = new LinkedList<>();
  private final List linkedServices = new LinkedList<>();

  /** @param type unique UUID of the service according to HAP specification. */
  public AbstractServiceImpl(String type) {
    this.type = type;
  }

  @Override
  public List getCharacteristics() {
    return Collections.unmodifiableList(characteristics);
  }

  @Override
  public String getType() {
    return type;
  }

  @Override
  public List getLinkedServices() {
    return Collections.unmodifiableList(linkedServices);
  }

  public void addCharacteristic(Characteristic characteristic) {
    this.characteristics.add(characteristic);
  }

  @Override
  public void addLinkedService(Service service) {
    this.linkedServices.add(service);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy