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

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

package com.github.lontime.extjobrunr.beans;

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

import org.jobrunr.jobs.context.JobDashboardLogger.Level;
import org.jobrunr.jobs.context.JobDashboardLogger.JobDashboardLogLine;
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 JobDashboardLogLineBean implements Bean {

    @PropertyDefinition
    private String level;
    @PropertyDefinition
    private Instant logInstant;
    @PropertyDefinition
    private String logMessage;

    public JobDashboardLogLineBean() {
    }

    public JobDashboardLogLineBean(JobDashboardLogLine logLine) {
        this.level = logLine.getLevel().name();
        this.logInstant = logLine.getLogInstant();
        this.logMessage = logLine.getLogMessage();
    }

    public JobDashboardLogLine toJobDashboardLogLine() {
        return new JobDashboardLogLine(Level.valueOf(this.level),
                this.getLogMessage());
    }

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

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

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

    //-----------------------------------------------------------------------
    /**
     * Gets the level.
     * @return the value of the property
     */
    public String getLevel() {
        return level;
    }

    /**
     * Sets the level.
     * @param level  the new value of the property
     */
    public void setLevel(String level) {
        this.level = level;
    }

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

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

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

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

    //-----------------------------------------------------------------------
    /**
     * Gets the logMessage.
     * @return the value of the property
     */
    public String getLogMessage() {
        return logMessage;
    }

    /**
     * Sets the logMessage.
     * @param logMessage  the new value of the property
     */
    public void setLogMessage(String logMessage) {
        this.logMessage = logMessage;
    }

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

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

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj != null && obj.getClass() == this.getClass()) {
            JobDashboardLogLineBean other = (JobDashboardLogLineBean) obj;
            return JodaBeanUtils.equal(getLevel(), other.getLevel()) &&
                    JodaBeanUtils.equal(getLogInstant(), other.getLogInstant()) &&
                    JodaBeanUtils.equal(getLogMessage(), other.getLogMessage());
        }
        return false;
    }

    @Override
    public int hashCode() {
        int hash = getClass().hashCode();
        hash = hash * 31 + JodaBeanUtils.hashCode(getLevel());
        hash = hash * 31 + JodaBeanUtils.hashCode(getLogInstant());
        hash = hash * 31 + JodaBeanUtils.hashCode(getLogMessage());
        return hash;
    }

    @Override
    public String toString() {
        StringBuilder buf = new StringBuilder(128);
        buf.append("JobDashboardLogLineBean{");
        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("level").append('=').append(JodaBeanUtils.toString(getLevel())).append(',').append(' ');
        buf.append("logInstant").append('=').append(JodaBeanUtils.toString(getLogInstant())).append(',').append(' ');
        buf.append("logMessage").append('=').append(JodaBeanUtils.toString(getLogMessage())).append(',').append(' ');
    }

    //-----------------------------------------------------------------------
    /**
     * The meta-bean for {@code JobDashboardLogLineBean}.
     */
    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 level} property.
         */
        private final MetaProperty level = DirectMetaProperty.ofReadWrite(
                this, "level", JobDashboardLogLineBean.class, String.class);
        /**
         * The meta-property for the {@code logInstant} property.
         */
        private final MetaProperty logInstant = DirectMetaProperty.ofReadWrite(
                this, "logInstant", JobDashboardLogLineBean.class, Instant.class);
        /**
         * The meta-property for the {@code logMessage} property.
         */
        private final MetaProperty logMessage = DirectMetaProperty.ofReadWrite(
                this, "logMessage", JobDashboardLogLineBean.class, String.class);
        /**
         * The meta-properties.
         */
        private final Map> metaPropertyMap$ = new DirectMetaPropertyMap(
                this, null,
                "level",
                "logInstant",
                "logMessage");

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

        @Override
        protected MetaProperty metaPropertyGet(String propertyName) {
            switch (propertyName.hashCode()) {
                case 102865796:  // level
                    return level;
                case -64510467:  // logInstant
                    return logInstant;
                case -1067155421:  // logMessage
                    return logMessage;
            }
            return super.metaPropertyGet(propertyName);
        }

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

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

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

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

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

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

        //-----------------------------------------------------------------------
        @Override
        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
            switch (propertyName.hashCode()) {
                case 102865796:  // level
                    return ((JobDashboardLogLineBean) bean).getLevel();
                case -64510467:  // logInstant
                    return ((JobDashboardLogLineBean) bean).getLogInstant();
                case -1067155421:  // logMessage
                    return ((JobDashboardLogLineBean) bean).getLogMessage();
            }
            return super.propertyGet(bean, propertyName, quiet);
        }

        @Override
        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
            switch (propertyName.hashCode()) {
                case 102865796:  // level
                    ((JobDashboardLogLineBean) bean).setLevel((String) newValue);
                    return;
                case -64510467:  // logInstant
                    ((JobDashboardLogLineBean) bean).setLogInstant((Instant) newValue);
                    return;
                case -1067155421:  // logMessage
                    ((JobDashboardLogLineBean) bean).setLogMessage((String) newValue);
                    return;
            }
            super.propertySet(bean, propertyName, newValue, quiet);
        }

    }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy