Commit d4b2780f authored by R.W.Majeed's avatar R.W.Majeed

class extension (not used yet)

parent fd870b26
package de.sekmi.histream.impl;
import de.sekmi.histream.Extension;
import de.sekmi.histream.Observation;
import de.sekmi.histream.ext.IdExtensionType;
* Extension to allow grouping/classification of facts.
* This can be seen similar to the {@code class} attribute
* in HTML which can be given to any element.
* <p>
* XXX still need to figure how to serialize the class id
* to the {@code fact/@class} attribute.
* </p>
* @author R.W.Majeed
public class ClassExtension implements Extension<ClassExtension.Clazz> {
public static class Clazz implements IdExtensionType{
private String id;
public String getId() {
return id;
public void setId(String id) { = id;
public Clazz createInstance(Observation observation) {
// TODO use modifier "class" to get the class value
// otherwise unable to create a class for the given observation
throw new UnsupportedOperationException();
//return null;
public Clazz createInstance(Object... args) throws UnsupportedOperationException, IllegalArgumentException {
if( args.length != 1 || !(args[0] instanceof String) ){
throw new IllegalArgumentException("Fact extension for class needs exactly one string argument for the class id");
Clazz c = new Clazz();
return c;
public Class<?>[] getInstanceTypes() {
return new Class[]{Clazz.class};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment