Skip to content
FixedEntityProperty.java 828 B
Newer Older
package it.inaf.oats.ia2.tapschemamanager.datalayer;

import java.io.Serializable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Represent an {@code EntityProperty} which value can't be modified by the
 * user.
 *
 * @author Sonia Zorba {@literal <zorba at oats.inaf.it>}
 */
public class FixedEntityProperty<T> implements EntityProperty, Serializable {

    private static final long serialVersionUID = -7009289405382798659L;
    private static final Logger log = LoggerFactory.getLogger(EntityPropertyInfo.class);

    private T value;

    public FixedEntityProperty(T value) {
        init(value);
    }

    @Override
    public final <X> void init(X initialValue) {
        this.value = (T) initialValue;
    }

    @Override
    public <X> X getValue(Class<X> type) {
        return (X) value;
    }
}