com.github.lontime.extjobrunr.beans.JobDetailsBean Maven / Gradle / Ivy
package com.github.lontime.extjobrunr.beans;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.jobrunr.jobs.JobDetails;
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 JobDetailsBean implements Bean {
@PropertyDefinition
private String className;
@PropertyDefinition
private String staticFieldName;
@PropertyDefinition
private String methodName;
@PropertyDefinition
private List jobParameters;
@PropertyDefinition
private Boolean cacheable;
public JobDetailsBean() {
}
public JobDetailsBean(JobDetails jobDetails) {
this.className = jobDetails.getClassName();
this.staticFieldName = jobDetails.getStaticFieldName();
this.methodName = jobDetails.getMethodName();
this.jobParameters = jobDetails.getJobParameters().stream()
//.map(s -> BeanMapHelper.toMap(new JobParameterBean(s)))
.map(s -> new JobParameterBean(s))
.collect(Collectors.toList());
this.cacheable = jobDetails.getCacheable();
}
public JobDetails toJobDetails() {
final JobDetails jobDetails = new JobDetails(this.getClassName(), this.getStaticFieldName(),
this.getMethodName(),
this.getJobParameters().stream()
//.map(s -> BeanMapHelper.toBean(JobParameterBean.meta(), s))
.map(s -> s.toJobParameter())
.collect(Collectors.toList()));
jobDetails.setCacheable(getCacheable());
return jobDetails;
}
//------------------------- AUTOGENERATED START -------------------------
/**
* The meta-bean for {@code JobDetailsBean}.
* @return the meta-bean, not null
*/
public static JobDetailsBean.Meta meta() {
return JobDetailsBean.Meta.INSTANCE;
}
static {
MetaBean.register(JobDetailsBean.Meta.INSTANCE);
}
@Override
public JobDetailsBean.Meta metaBean() {
return JobDetailsBean.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 staticFieldName.
* @return the value of the property
*/
public String getStaticFieldName() {
return staticFieldName;
}
/**
* Sets the staticFieldName.
* @param staticFieldName the new value of the property
*/
public void setStaticFieldName(String staticFieldName) {
this.staticFieldName = staticFieldName;
}
/**
* Gets the the {@code staticFieldName} property.
* @return the property, not null
*/
public final Property staticFieldName() {
return metaBean().staticFieldName().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the methodName.
* @return the value of the property
*/
public String getMethodName() {
return methodName;
}
/**
* Sets the methodName.
* @param methodName the new value of the property
*/
public void setMethodName(String methodName) {
this.methodName = methodName;
}
/**
* Gets the the {@code methodName} property.
* @return the property, not null
*/
public final Property methodName() {
return metaBean().methodName().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the jobParameters.
* @return the value of the property
*/
public List getJobParameters() {
return jobParameters;
}
/**
* Sets the jobParameters.
* @param jobParameters the new value of the property
*/
public void setJobParameters(List jobParameters) {
this.jobParameters = jobParameters;
}
/**
* Gets the the {@code jobParameters} property.
* @return the property, not null
*/
public final Property> jobParameters() {
return metaBean().jobParameters().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the cacheable.
* @return the value of the property
*/
public Boolean getCacheable() {
return cacheable;
}
/**
* Sets the cacheable.
* @param cacheable the new value of the property
*/
public void setCacheable(Boolean cacheable) {
this.cacheable = cacheable;
}
/**
* Gets the the {@code cacheable} property.
* @return the property, not null
*/
public final Property cacheable() {
return metaBean().cacheable().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public JobDetailsBean clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
JobDetailsBean other = (JobDetailsBean) obj;
return JodaBeanUtils.equal(getClassName(), other.getClassName()) &&
JodaBeanUtils.equal(getStaticFieldName(), other.getStaticFieldName()) &&
JodaBeanUtils.equal(getMethodName(), other.getMethodName()) &&
JodaBeanUtils.equal(getJobParameters(), other.getJobParameters()) &&
JodaBeanUtils.equal(getCacheable(), other.getCacheable());
}
return false;
}
@Override
public int hashCode() {
int hash = getClass().hashCode();
hash = hash * 31 + JodaBeanUtils.hashCode(getClassName());
hash = hash * 31 + JodaBeanUtils.hashCode(getStaticFieldName());
hash = hash * 31 + JodaBeanUtils.hashCode(getMethodName());
hash = hash * 31 + JodaBeanUtils.hashCode(getJobParameters());
hash = hash * 31 + JodaBeanUtils.hashCode(getCacheable());
return hash;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(192);
buf.append("JobDetailsBean{");
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("staticFieldName").append('=').append(JodaBeanUtils.toString(getStaticFieldName())).append(',').append(' ');
buf.append("methodName").append('=').append(JodaBeanUtils.toString(getMethodName())).append(',').append(' ');
buf.append("jobParameters").append('=').append(JodaBeanUtils.toString(getJobParameters())).append(',').append(' ');
buf.append("cacheable").append('=').append(JodaBeanUtils.toString(getCacheable())).append(',').append(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code JobDetailsBean}.
*/
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", JobDetailsBean.class, String.class);
/**
* The meta-property for the {@code staticFieldName} property.
*/
private final MetaProperty staticFieldName = DirectMetaProperty.ofReadWrite(
this, "staticFieldName", JobDetailsBean.class, String.class);
/**
* The meta-property for the {@code methodName} property.
*/
private final MetaProperty methodName = DirectMetaProperty.ofReadWrite(
this, "methodName", JobDetailsBean.class, String.class);
/**
* The meta-property for the {@code jobParameters} property.
*/
@SuppressWarnings({"unchecked", "rawtypes" })
private final MetaProperty> jobParameters = DirectMetaProperty.ofReadWrite(
this, "jobParameters", JobDetailsBean.class, (Class) List.class);
/**
* The meta-property for the {@code cacheable} property.
*/
private final MetaProperty cacheable = DirectMetaProperty.ofReadWrite(
this, "cacheable", JobDetailsBean.class, Boolean.class);
/**
* The meta-properties.
*/
private final Map> metaPropertyMap$ = new DirectMetaPropertyMap(
this, null,
"className",
"staticFieldName",
"methodName",
"jobParameters",
"cacheable");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case -9888733: // className
return className;
case -549376041: // staticFieldName
return staticFieldName;
case -723163380: // methodName
return methodName;
case -1443008121: // jobParameters
return jobParameters;
case -553208868: // cacheable
return cacheable;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder extends JobDetailsBean> builder() {
return new DirectBeanBuilder<>(new JobDetailsBean());
}
@Override
public Class extends JobDetailsBean> beanType() {
return JobDetailsBean.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 staticFieldName} property.
* @return the meta-property, not null
*/
public final MetaProperty staticFieldName() {
return staticFieldName;
}
/**
* The meta-property for the {@code methodName} property.
* @return the meta-property, not null
*/
public final MetaProperty methodName() {
return methodName;
}
/**
* The meta-property for the {@code jobParameters} property.
* @return the meta-property, not null
*/
public final MetaProperty> jobParameters() {
return jobParameters;
}
/**
* The meta-property for the {@code cacheable} property.
* @return the meta-property, not null
*/
public final MetaProperty cacheable() {
return cacheable;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case -9888733: // className
return ((JobDetailsBean) bean).getClassName();
case -549376041: // staticFieldName
return ((JobDetailsBean) bean).getStaticFieldName();
case -723163380: // methodName
return ((JobDetailsBean) bean).getMethodName();
case -1443008121: // jobParameters
return ((JobDetailsBean) bean).getJobParameters();
case -553208868: // cacheable
return ((JobDetailsBean) bean).getCacheable();
}
return super.propertyGet(bean, propertyName, quiet);
}
@SuppressWarnings("unchecked")
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case -9888733: // className
((JobDetailsBean) bean).setClassName((String) newValue);
return;
case -549376041: // staticFieldName
((JobDetailsBean) bean).setStaticFieldName((String) newValue);
return;
case -723163380: // methodName
((JobDetailsBean) bean).setMethodName((String) newValue);
return;
case -1443008121: // jobParameters
((JobDetailsBean) bean).setJobParameters((List) newValue);
return;
case -553208868: // cacheable
((JobDetailsBean) bean).setCacheable((Boolean) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
}
//-------------------------- AUTOGENERATED END --------------------------
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy