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

tw.yukina.notion.sdk.builder.EquationTextBuilder Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package tw.yukina.notion.sdk.builder;

import org.jetbrains.annotations.NotNull;
import tw.yukina.notion.sdk.model.common.rich.Equation;
import tw.yukina.notion.sdk.model.common.rich.EquationText;
import tw.yukina.notion.sdk.model.common.rich.RichText;
import tw.yukina.notion.sdk.model.common.rich.TextType;

public class EquationTextBuilder extends RichTextBuilder {

    private String expression = "";

    public EquationTextBuilder setExpression(String expression){
        this.expression = expression;
        return this;
    }

    @NotNull
    public static EquationTextBuilder of(String expression){
        EquationTextBuilder equationTextBuilder = new EquationTextBuilder();
        equationTextBuilder.setExpression(expression);
        return equationTextBuilder;
    }

    @Override
    public RichText buildSelf() {
        Equation equation = new Equation();
        equation.setExpression(expression);

        EquationText equationText = new EquationText();
        equationText.setType(TextType.EQUATION);
        equationText.setEquation(equation);
        equationText.setPlainText(expression);

        setRichTextStyle(equationText);
        return equationText;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy