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

com.blossomproject.generator.configuration.BigDecimalFieldBuilder Maven / Gradle / Ivy

package com.blossomproject.generator.configuration;

import com.google.common.base.Preconditions;
import com.blossomproject.generator.configuration.model.Field;
import com.blossomproject.generator.configuration.model.impl.DefaultField;
import java.math.BigDecimal;

public class BigDecimalFieldBuilder extends FieldBuilder {

  private final Integer precision;
  private final Integer fractionalPrecision;

  BigDecimalFieldBuilder(FieldsBuilder parent, String name, Integer precision,
    Integer fractionalPrecision) {
    super(parent, name, BigDecimal.class, "decimal(" + precision + "," + fractionalPrecision + ")");
    Preconditions.checkState(precision > 0);
    Preconditions.checkState(precision >= fractionalPrecision);
    this.precision = precision;
    this.fractionalPrecision = fractionalPrecision;
  }

  @Override
  Field build() {
    return new DefaultField(name, columnName, className, jdbcType, required, updatable, nullable,
      defaultValue, searchable);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy