com.github.lontime.extjobrunr.beans.states.ProcessingStateBean Maven / Gradle / Ivy
package com.github.lontime.extjobrunr.beans.states;
import java.time.Instant;
import java.util.Map;
import java.util.UUID;
import org.jobrunr.jobs.states.JobState;
import org.jobrunr.jobs.states.ProcessingState;
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 ProcessingStateBean implements Bean, JobStateBean {
@PropertyDefinition
private String serverId;
@PropertyDefinition
private String state;
@PropertyDefinition
private Instant createdAt;
@PropertyDefinition
private Instant updatedAt;
public ProcessingStateBean() {
}
public ProcessingStateBean(ProcessingState processingState) {
this.serverId = processingState.getServerId().toString();
this.state = processingState.getName().name();
this.createdAt = processingState.getCreatedAt();
this.updatedAt = processingState.getCreatedAt();
}
@Override
public JobState toState() {
return new ProcessingState(UUID.fromString(this.getServerId()));
}
//------------------------- AUTOGENERATED START -------------------------
/**
* The meta-bean for {@code ProcessingStateBean}.
* @return the meta-bean, not null
*/
public static ProcessingStateBean.Meta meta() {
return ProcessingStateBean.Meta.INSTANCE;
}
static {
MetaBean.register(ProcessingStateBean.Meta.INSTANCE);
}
@Override
public ProcessingStateBean.Meta metaBean() {
return ProcessingStateBean.Meta.INSTANCE;
}
//-----------------------------------------------------------------------
/**
* Gets the serverId.
* @return the value of the property
*/
public String getServerId() {
return serverId;
}
/**
* Sets the serverId.
* @param serverId the new value of the property
*/
public void setServerId(String serverId) {
this.serverId = serverId;
}
/**
* Gets the the {@code serverId} property.
* @return the property, not null
*/
public final Property serverId() {
return metaBean().serverId().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the state.
* @return the value of the property
*/
public String getState() {
return state;
}
/**
* Sets the state.
* @param state the new value of the property
*/
public void setState(String state) {
this.state = state;
}
/**
* Gets the the {@code state} property.
* @return the property, not null
*/
public final Property state() {
return metaBean().state().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the createdAt.
* @return the value of the property
*/
public Instant getCreatedAt() {
return createdAt;
}
/**
* Sets the createdAt.
* @param createdAt the new value of the property
*/
public void setCreatedAt(Instant createdAt) {
this.createdAt = createdAt;
}
/**
* Gets the the {@code createdAt} property.
* @return the property, not null
*/
public final Property createdAt() {
return metaBean().createdAt().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the updatedAt.
* @return the value of the property
*/
public Instant getUpdatedAt() {
return updatedAt;
}
/**
* Sets the updatedAt.
* @param updatedAt the new value of the property
*/
public void setUpdatedAt(Instant updatedAt) {
this.updatedAt = updatedAt;
}
/**
* Gets the the {@code updatedAt} property.
* @return the property, not null
*/
public final Property updatedAt() {
return metaBean().updatedAt().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public ProcessingStateBean clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
ProcessingStateBean other = (ProcessingStateBean) obj;
return JodaBeanUtils.equal(getServerId(), other.getServerId()) &&
JodaBeanUtils.equal(getState(), other.getState()) &&
JodaBeanUtils.equal(getCreatedAt(), other.getCreatedAt()) &&
JodaBeanUtils.equal(getUpdatedAt(), other.getUpdatedAt());
}
return false;
}
@Override
public int hashCode() {
int hash = getClass().hashCode();
hash = hash * 31 + JodaBeanUtils.hashCode(getServerId());
hash = hash * 31 + JodaBeanUtils.hashCode(getState());
hash = hash * 31 + JodaBeanUtils.hashCode(getCreatedAt());
hash = hash * 31 + JodaBeanUtils.hashCode(getUpdatedAt());
return hash;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(160);
buf.append("ProcessingStateBean{");
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("serverId").append('=').append(JodaBeanUtils.toString(getServerId())).append(',').append(' ');
buf.append("state").append('=').append(JodaBeanUtils.toString(getState())).append(',').append(' ');
buf.append("createdAt").append('=').append(JodaBeanUtils.toString(getCreatedAt())).append(',').append(' ');
buf.append("updatedAt").append('=').append(JodaBeanUtils.toString(getUpdatedAt())).append(',').append(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code ProcessingStateBean}.
*/
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 serverId} property.
*/
private final MetaProperty serverId = DirectMetaProperty.ofReadWrite(
this, "serverId", ProcessingStateBean.class, String.class);
/**
* The meta-property for the {@code state} property.
*/
private final MetaProperty state = DirectMetaProperty.ofReadWrite(
this, "state", ProcessingStateBean.class, String.class);
/**
* The meta-property for the {@code createdAt} property.
*/
private final MetaProperty createdAt = DirectMetaProperty.ofReadWrite(
this, "createdAt", ProcessingStateBean.class, Instant.class);
/**
* The meta-property for the {@code updatedAt} property.
*/
private final MetaProperty updatedAt = DirectMetaProperty.ofReadWrite(
this, "updatedAt", ProcessingStateBean.class, Instant.class);
/**
* The meta-properties.
*/
private final Map> metaPropertyMap$ = new DirectMetaPropertyMap(
this, null,
"serverId",
"state",
"createdAt",
"updatedAt");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case 1379103678: // serverId
return serverId;
case 109757585: // state
return state;
case 598371643: // createdAt
return createdAt;
case -1949194674: // updatedAt
return updatedAt;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder extends ProcessingStateBean> builder() {
return new DirectBeanBuilder<>(new ProcessingStateBean());
}
@Override
public Class extends ProcessingStateBean> beanType() {
return ProcessingStateBean.class;
}
@Override
public Map> metaPropertyMap() {
return metaPropertyMap$;
}
//-----------------------------------------------------------------------
/**
* The meta-property for the {@code serverId} property.
* @return the meta-property, not null
*/
public final MetaProperty serverId() {
return serverId;
}
/**
* The meta-property for the {@code state} property.
* @return the meta-property, not null
*/
public final MetaProperty state() {
return state;
}
/**
* The meta-property for the {@code createdAt} property.
* @return the meta-property, not null
*/
public final MetaProperty createdAt() {
return createdAt;
}
/**
* The meta-property for the {@code updatedAt} property.
* @return the meta-property, not null
*/
public final MetaProperty updatedAt() {
return updatedAt;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case 1379103678: // serverId
return ((ProcessingStateBean) bean).getServerId();
case 109757585: // state
return ((ProcessingStateBean) bean).getState();
case 598371643: // createdAt
return ((ProcessingStateBean) bean).getCreatedAt();
case -1949194674: // updatedAt
return ((ProcessingStateBean) bean).getUpdatedAt();
}
return super.propertyGet(bean, propertyName, quiet);
}
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case 1379103678: // serverId
((ProcessingStateBean) bean).setServerId((String) newValue);
return;
case 109757585: // state
((ProcessingStateBean) bean).setState((String) newValue);
return;
case 598371643: // createdAt
((ProcessingStateBean) bean).setCreatedAt((Instant) newValue);
return;
case -1949194674: // updatedAt
((ProcessingStateBean) bean).setUpdatedAt((Instant) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
}
//-------------------------- AUTOGENERATED END --------------------------
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy