io.github.hapjava.services.impl.AbstractServiceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hap Show documentation
Show all versions of hap Show documentation
Homekit Accessory Protocol for Java
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);
}
}