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

cdc.applic.dictionaries.edit.EnUserDefinedAssertion Maven / Gradle / Ivy

There is a newer version: 0.13.3
Show newest version
package cdc.applic.dictionaries.edit;

import cdc.applic.expressions.Expression;
import cdc.util.lang.Checks;

public final class EnUserDefinedAssertion extends EnAbstractOwnedElement>
        implements EnExpressionItem {
    public static final String KIND = "UserDefinedAssertion";
    private Expression expression;

    protected EnUserDefinedAssertion(Builder builder) {
        super(builder);
        this.expression = builder.expression;
        addToOwner();
    }

    @Override
    public String getKind() {
        return KIND;
    }

    @Override
    public EnRef getRef() {
        return getRef(EnUserDefinedAssertion.class);
    }

    @Override
    public Expression getExpression() {
        return expression;
    }

    @Override
    public void setExpression(Expression expression) {
        this.expression = Checks.isNotNull(expression, EnNames.EXPRESSION);

        fireSemanticChange(EnNames.EXPRESSION);
    }

    static Builder builder(EnDictionary owner) {
        return new Builder(owner);
    }

    public static final class Builder
            extends EnAbstractOwnedElement.Builder>
            implements EnExpressionBuilding {
        private Expression expression = Expression.TRUE;

        protected Builder(EnDictionary owner) {
            super(owner);
        }

        @Override
        public Class getBuiltClass() {
            return EnUserDefinedAssertion.class;
        }

        @Override
        public Builder expression(Expression expression) {
            Checks.isNotNull(expression, EnNames.EXPRESSION);
            this.expression = expression;
            return self();
        }

        @Override
        public EnUserDefinedAssertion build() {
            return wrap(new EnUserDefinedAssertion(this));
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy