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

com.github.lontime.extjobrunr.beans.EstimationBean Maven / Gradle / Ivy

package com.github.lontime.extjobrunr.beans;

import java.time.Instant;
import java.util.Map;

import org.jobrunr.storage.JobStatsExtended;
import org.joda.beans.Bean;
import org.joda.beans.BeanBuilder;
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.MetaBean;
import org.joda.beans.MetaProperty;
import org.joda.beans.Property;
import org.joda.beans.gen.BeanDefinition;
import org.joda.beans.gen.PropertyDefinition;
import org.joda.beans.impl.direct.DirectBeanBuilder;
import org.joda.beans.impl.direct.DirectMetaBean;
import org.joda.beans.impl.direct.DirectMetaProperty;
import org.joda.beans.impl.direct.DirectMetaPropertyMap;

@BeanDefinition
public class EstimationBean implements Bean {

    @PropertyDefinition
    private Boolean processingDone;

    @PropertyDefinition
    private Boolean estimatedProcessingTimeAvailable;

    @PropertyDefinition
    private Instant estimatedProcessingFinishedAt;

    public EstimationBean() {
    }

    public EstimationBean(JobStatsExtended.Estimation estimation) {
        this.processingDone = estimation.isProcessingDone();
        this.estimatedProcessingTimeAvailable = estimation.isEstimatedProcessingFinishedInstantAvailable();
        this.estimatedProcessingFinishedAt = estimation.getEstimatedProcessingFinishedAt();
    }

    //------------------------- AUTOGENERATED START -------------------------
    /**
     * The meta-bean for {@code EstimationBean}.
     * @return the meta-bean, not null
     */
    public static EstimationBean.Meta meta() {
        return EstimationBean.Meta.INSTANCE;
    }

    static {
        MetaBean.register(EstimationBean.Meta.INSTANCE);
    }

    @Override
    public EstimationBean.Meta metaBean() {
        return EstimationBean.Meta.INSTANCE;
    }

    //-----------------------------------------------------------------------
    /**
     * Gets the processingDone.
     * @return the value of the property
     */
    public Boolean getProcessingDone() {
        return processingDone;
    }

    /**
     * Sets the processingDone.
     * @param processingDone  the new value of the property
     */
    public void setProcessingDone(Boolean processingDone) {
        this.processingDone = processingDone;
    }

    /**
     * Gets the the {@code processingDone} property.
     * @return the property, not null
     */
    public final Property processingDone() {
        return metaBean().processingDone().createProperty(this);
    }

    //-----------------------------------------------------------------------
    /**
     * Gets the estimatedProcessingTimeAvailable.
     * @return the value of the property
     */
    public Boolean getEstimatedProcessingTimeAvailable() {
        return estimatedProcessingTimeAvailable;
    }

    /**
     * Sets the estimatedProcessingTimeAvailable.
     * @param estimatedProcessingTimeAvailable  the new value of the property
     */
    public void setEstimatedProcessingTimeAvailable(Boolean estimatedProcessingTimeAvailable) {
        this.estimatedProcessingTimeAvailable = estimatedProcessingTimeAvailable;
    }

    /**
     * Gets the the {@code estimatedProcessingTimeAvailable} property.
     * @return the property, not null
     */
    public final Property estimatedProcessingTimeAvailable() {
        return metaBean().estimatedProcessingTimeAvailable().createProperty(this);
    }

    //-----------------------------------------------------------------------
    /**
     * Gets the estimatedProcessingFinishedAt.
     * @return the value of the property
     */
    public Instant getEstimatedProcessingFinishedAt() {
        return estimatedProcessingFinishedAt;
    }

    /**
     * Sets the estimatedProcessingFinishedAt.
     * @param estimatedProcessingFinishedAt  the new value of the property
     */
    public void setEstimatedProcessingFinishedAt(Instant estimatedProcessingFinishedAt) {
        this.estimatedProcessingFinishedAt = estimatedProcessingFinishedAt;
    }

    /**
     * Gets the the {@code estimatedProcessingFinishedAt} property.
     * @return the property, not null
     */
    public final Property estimatedProcessingFinishedAt() {
        return metaBean().estimatedProcessingFinishedAt().createProperty(this);
    }

    //-----------------------------------------------------------------------
    @Override
    public EstimationBean clone() {
        return JodaBeanUtils.cloneAlways(this);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj != null && obj.getClass() == this.getClass()) {
            EstimationBean other = (EstimationBean) obj;
            return JodaBeanUtils.equal(getProcessingDone(), other.getProcessingDone()) &&
                    JodaBeanUtils.equal(getEstimatedProcessingTimeAvailable(), other.getEstimatedProcessingTimeAvailable()) &&
                    JodaBeanUtils.equal(getEstimatedProcessingFinishedAt(), other.getEstimatedProcessingFinishedAt());
        }
        return false;
    }

    @Override
    public int hashCode() {
        int hash = getClass().hashCode();
        hash = hash * 31 + JodaBeanUtils.hashCode(getProcessingDone());
        hash = hash * 31 + JodaBeanUtils.hashCode(getEstimatedProcessingTimeAvailable());
        hash = hash * 31 + JodaBeanUtils.hashCode(getEstimatedProcessingFinishedAt());
        return hash;
    }

    @Override
    public String toString() {
        StringBuilder buf = new StringBuilder(128);
        buf.append("EstimationBean{");
        int len = buf.length();
        toString(buf);
        if (buf.length() > len) {
            buf.setLength(buf.length() - 2);
        }
        buf.append('}');
        return buf.toString();
    }

    protected void toString(StringBuilder buf) {
        buf.append("processingDone").append('=').append(JodaBeanUtils.toString(getProcessingDone())).append(',').append(' ');
        buf.append("estimatedProcessingTimeAvailable").append('=').append(JodaBeanUtils.toString(getEstimatedProcessingTimeAvailable())).append(',').append(' ');
        buf.append("estimatedProcessingFinishedAt").append('=').append(JodaBeanUtils.toString(getEstimatedProcessingFinishedAt())).append(',').append(' ');
    }

    //-----------------------------------------------------------------------
    /**
     * The meta-bean for {@code EstimationBean}.
     */
    public static class Meta extends DirectMetaBean {
        /**
         * The singleton instance of the meta-bean.
         */
        static final Meta INSTANCE = new Meta();

        /**
         * The meta-property for the {@code processingDone} property.
         */
        private final MetaProperty processingDone = DirectMetaProperty.ofReadWrite(
                this, "processingDone", EstimationBean.class, Boolean.class);
        /**
         * The meta-property for the {@code estimatedProcessingTimeAvailable} property.
         */
        private final MetaProperty estimatedProcessingTimeAvailable = DirectMetaProperty.ofReadWrite(
                this, "estimatedProcessingTimeAvailable", EstimationBean.class, Boolean.class);
        /**
         * The meta-property for the {@code estimatedProcessingFinishedAt} property.
         */
        private final MetaProperty estimatedProcessingFinishedAt = DirectMetaProperty.ofReadWrite(
                this, "estimatedProcessingFinishedAt", EstimationBean.class, Instant.class);
        /**
         * The meta-properties.
         */
        private final Map> metaPropertyMap$ = new DirectMetaPropertyMap(
                this, null,
                "processingDone",
                "estimatedProcessingTimeAvailable",
                "estimatedProcessingFinishedAt");

        /**
         * Restricted constructor.
         */
        protected Meta() {
        }

        @Override
        protected MetaProperty metaPropertyGet(String propertyName) {
            switch (propertyName.hashCode()) {
                case 195495221:  // processingDone
                    return processingDone;
                case 1539201613:  // estimatedProcessingTimeAvailable
                    return estimatedProcessingTimeAvailable;
                case -1792785900:  // estimatedProcessingFinishedAt
                    return estimatedProcessingFinishedAt;
            }
            return super.metaPropertyGet(propertyName);
        }

        @Override
        public BeanBuilder builder() {
            return new DirectBeanBuilder<>(new EstimationBean());
        }

        @Override
        public Class beanType() {
            return EstimationBean.class;
        }

        @Override
        public Map> metaPropertyMap() {
            return metaPropertyMap$;
        }

        //-----------------------------------------------------------------------
        /**
         * The meta-property for the {@code processingDone} property.
         * @return the meta-property, not null
         */
        public final MetaProperty processingDone() {
            return processingDone;
        }

        /**
         * The meta-property for the {@code estimatedProcessingTimeAvailable} property.
         * @return the meta-property, not null
         */
        public final MetaProperty estimatedProcessingTimeAvailable() {
            return estimatedProcessingTimeAvailable;
        }

        /**
         * The meta-property for the {@code estimatedProcessingFinishedAt} property.
         * @return the meta-property, not null
         */
        public final MetaProperty estimatedProcessingFinishedAt() {
            return estimatedProcessingFinishedAt;
        }

        //-----------------------------------------------------------------------
        @Override
        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
            switch (propertyName.hashCode()) {
                case 195495221:  // processingDone
                    return ((EstimationBean) bean).getProcessingDone();
                case 1539201613:  // estimatedProcessingTimeAvailable
                    return ((EstimationBean) bean).getEstimatedProcessingTimeAvailable();
                case -1792785900:  // estimatedProcessingFinishedAt
                    return ((EstimationBean) bean).getEstimatedProcessingFinishedAt();
            }
            return super.propertyGet(bean, propertyName, quiet);
        }

        @Override
        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
            switch (propertyName.hashCode()) {
                case 195495221:  // processingDone
                    ((EstimationBean) bean).setProcessingDone((Boolean) newValue);
                    return;
                case 1539201613:  // estimatedProcessingTimeAvailable
                    ((EstimationBean) bean).setEstimatedProcessingTimeAvailable((Boolean) newValue);
                    return;
                case -1792785900:  // estimatedProcessingFinishedAt
                    ((EstimationBean) bean).setEstimatedProcessingFinishedAt((Instant) newValue);
                    return;
            }
            super.propertySet(bean, propertyName, newValue, quiet);
        }

    }

    //-------------------------- AUTOGENERATED END --------------------------
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy