
io.smilego.tenant.model.Parameter Maven / Gradle / Ivy
package io.smilego.tenant.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.smilego.tenant.util.StringUtil;
import lombok.*;
import javax.persistence.*;
import java.math.BigDecimal;
@Entity
@Table(name = "t_param", schema = "tenant")
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Parameter extends BaseEntity {
private static final long serialVersionUID = 1L;
@ManyToOne
@JoinColumn(name = "tenant_id", nullable = false)
private Tenant tenant;
@ManyToOne
@JoinColumn(name = "service_id", nullable = false)
private Application service;
@ManyToOne
@JoinColumn(name = "property_id", nullable = false)
private Property property;
@Column(name = "value", columnDefinition = "TEXT", nullable = false)
private String value;
@Transient
private String key;
@JsonIgnore
public Boolean getBooleanValue() {
return StringUtil.isBoolean(this.getValue()) && this.getValue().equals("true");
}
@JsonIgnore
public Integer getIntegerValue() {
return StringUtil.isInteger(this.getValue()) ? Integer.parseInt(this.getValue()):0;
}
@JsonIgnore
public BigDecimal getBigDecimalValue() {
return StringUtil.isBigDecimal(this.getValue()) ? BigDecimal.valueOf(Double.parseDouble(this.getValue())):BigDecimal.ZERO;
}
@JsonIgnore
public Long getLongValue() {
return StringUtil.isLong(this.getValue()) ? Long.parseLong(this.getValue()) :0L;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy