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

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

package com.github.lontime.extjobrunr.beans;

import java.util.Map;

import org.jobrunr.jobs.JobParameter;
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 JobParameterBean implements Bean {

    @PropertyDefinition
    private String className;

    @PropertyDefinition
    private String actualClassName;

    @PropertyDefinition
    private Object object;

    public JobParameterBean() {
    }

    public JobParameterBean(JobParameter jobParameter) {
        this.className = jobParameter.getClassName();
        this.actualClassName = jobParameter.getActualClassName();
        this.object = jobParameter.getObject();
    }

    public JobParameter toJobParameter() {
        return new JobParameter(this.getClassName(), this.getObject());
    }

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

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

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

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

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

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

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

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

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

    //-----------------------------------------------------------------------
    /**
     * Gets the object.
     * @return the value of the property
     */
    public Object getObject() {
        return object;
    }

    /**
     * Sets the object.
     * @param object  the new value of the property
     */
    public void setObject(Object object) {
        this.object = object;
    }

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

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

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj != null && obj.getClass() == this.getClass()) {
            JobParameterBean other = (JobParameterBean) obj;
            return JodaBeanUtils.equal(getClassName(), other.getClassName()) &&
                    JodaBeanUtils.equal(getActualClassName(), other.getActualClassName()) &&
                    JodaBeanUtils.equal(getObject(), other.getObject());
        }
        return false;
    }

    @Override
    public int hashCode() {
        int hash = getClass().hashCode();
        hash = hash * 31 + JodaBeanUtils.hashCode(getClassName());
        hash = hash * 31 + JodaBeanUtils.hashCode(getActualClassName());
        hash = hash * 31 + JodaBeanUtils.hashCode(getObject());
        return hash;
    }

    @Override
    public String toString() {
        StringBuilder buf = new StringBuilder(128);
        buf.append("JobParameterBean{");
        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("className").append('=').append(JodaBeanUtils.toString(getClassName())).append(',').append(' ');
        buf.append("actualClassName").append('=').append(JodaBeanUtils.toString(getActualClassName())).append(',').append(' ');
        buf.append("object").append('=').append(JodaBeanUtils.toString(getObject())).append(',').append(' ');
    }

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

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

        @Override
        protected MetaProperty metaPropertyGet(String propertyName) {
            switch (propertyName.hashCode()) {
                case -9888733:  // className
                    return className;
                case -319393227:  // actualClassName
                    return actualClassName;
                case -1023368385:  // object
                    return object;
            }
            return super.metaPropertyGet(propertyName);
        }

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

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

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

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

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

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

        //-----------------------------------------------------------------------
        @Override
        protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
            switch (propertyName.hashCode()) {
                case -9888733:  // className
                    return ((JobParameterBean) bean).getClassName();
                case -319393227:  // actualClassName
                    return ((JobParameterBean) bean).getActualClassName();
                case -1023368385:  // object
                    return ((JobParameterBean) bean).getObject();
            }
            return super.propertyGet(bean, propertyName, quiet);
        }

        @Override
        protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
            switch (propertyName.hashCode()) {
                case -9888733:  // className
                    ((JobParameterBean) bean).setClassName((String) newValue);
                    return;
                case -319393227:  // actualClassName
                    ((JobParameterBean) bean).setActualClassName((String) newValue);
                    return;
                case -1023368385:  // object
                    ((JobParameterBean) bean).setObject((Object) newValue);
                    return;
            }
            super.propertySet(bean, propertyName, newValue, quiet);
        }

    }

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