package tc.oc.pgm.features; import java.util.Optional; import javax.annotation.Nullable; import tc.oc.commons.core.inspect.Inspectable; /** * Methods common to {@link FeatureDefinition} and {@link FeatureReference}. * * When any of these methods are called on a reference, they will be dispatched * to the proxy object rather than the definition. */ public interface FeatureBase extends Inspectable { Class getFeatureType(); String getFeatureName(); boolean isDefined(); void assertDefined() throws IllegalStateException; @Nullable Class getDefinitionType(); default Class needDefinitionType() { assertDefined(); return getDefinitionType(); } FeatureDefinition getDefinition() throws IllegalStateException; Optional tryDefinition(); }