最近在开发一个Dolphinescheduler 的接口调用,要频繁的对数据进行操作,一时间没找到Dolphinescheduler的相关Java类,
于是自己临时写了些代码,渐渐的发现,这些代码都是POJO类,写起来非常无聊,如果能根据json数据自动生成相关java类,不就可以一劳永逸了吗?
其实写这个工具并不难,但是没时间搞这个,于是网上搜索了一下这样的工具,发现还真的已经存在。
就是下面这个链接:
https://www.site24x7.com/tools/json-to-java.html
{"id":4,"code":6774554758464,"name":"shellProcess","version":1,"description":"test","projectCode":6742419011264,"userId":2,"taskType":"SHELL","taskParams":{"resourceList":[],"localParams":[],"rawScript":"echo \"Hello World\"","dependence":{},"conditionResult":{"successNode":[],"failedNode":[]},"waitStartTimeout":{},"switchResult":{}},"taskParamList":[],"taskParamMap":{},"flag":"YES","taskPriority":"MEDIUM","userName":null,"projectName":null,"workerGroup":"default","environmentCode":6742316552768,"failRetryTimes":0,"failRetryInterval":1,"timeoutFlag":"CLOSE","timeoutNotifyStrategy":null,"timeout":0,"delayTime":0,"resourceIds":"","createTime":"2022-09-05 13:44:34","updateTime":"2022-09-05 13:44:34","modifyBy":null,"operator":2,"operateTime":"2022-09-05 13:44:34","dependence":"{}"}
public class TaskDefinition {
private float id;
private float code;
private String name;
private float version;
private String description;
private float projectCode;
private float userId;
private String taskType;
TaskParams TaskParamsObject;
ArrayList<Object> taskParamList = new ArrayList<Object>();
TaskParamMap TaskParamMapObject;
private String flag;
private String taskPriority;
private String userName = null;
private String projectName = null;
private String workerGroup;
private float environmentCode;
private float failRetryTimes;
private float failRetryInterval;
private String timeoutFlag;
private String timeoutNotifyStrategy = null;
private float timeout;
private float delayTime;
private String resourceIds;
private String createTime;
private String updateTime;
private String modifyBy = null;
private float operator;
private String operateTime;
private String dependence;
// Getter Methods
public float getId() {
return id;
}
public float getCode() {
return code;
}
public String getName() {
return name;
}
public float getVersion() {
return version;
}
public String getDescription() {
return description;
}
public float getProjectCode() {
return projectCode;
}
public float getUserId() {
return userId;
}
public String getTaskType() {
return taskType;
}
public TaskParams getTaskParams() {
return TaskParamsObject;
}
public TaskParamMap getTaskParamMap() {
return TaskParamMapObject;
}
public String getFlag() {
return flag;
}
public String getTaskPriority() {
return taskPriority;
}
public String getUserName() {
return userName;
}
public String getProjectName() {
return projectName;
}
public String getWorkerGroup() {
return workerGroup;
}
public float getEnvironmentCode() {
return environmentCode;
}
public float getFailRetryTimes() {
return failRetryTimes;
}
public float getFailRetryInterval() {
return failRetryInterval;
}
public String getTimeoutFlag() {
return timeoutFlag;
}
public String getTimeoutNotifyStrategy() {
return timeoutNotifyStrategy;
}
public float getTimeout() {
return timeout;
}
public float getDelayTime() {
return delayTime;
}
public String getResourceIds() {
return resourceIds;
}
public String getCreateTime() {
return createTime;
}
public String getUpdateTime() {
return updateTime;
}
public String getModifyBy() {
return modifyBy;
}
public float getOperator() {
return operator;
}
public String getOperateTime() {
return operateTime;
}
public String getDependence() {
return dependence;
}
// Setter Methods
public void setId( float id ) {
this.id = id;
}
public void setCode( float code ) {
this.code = code;
}
public void setName( String name ) {
this.name = name;
}
public void setVersion( float version ) {
this.version = version;
}
public void setDescription( String description ) {
this.description = description;
}
public void setProjectCode( float projectCode ) {
this.projectCode = projectCode;
}
public void setUserId( float userId ) {
this.userId = userId;
}
public void setTaskType( String taskType ) {
this.taskType = taskType;
}
public void setTaskParams( TaskParams taskParamsObject ) {
this.TaskParamsObject = taskParamsObject;
}
public void setTaskParamMap( TaskParamMap taskParamMapObject ) {
this.TaskParamMapObject = taskParamMapObject;
}
public void setFlag( String flag ) {
this.flag = flag;
}
public void setTaskPriority( String taskPriority ) {
this.taskPriority = taskPriority;
}
public void setUserName( String userName ) {
this.userName = userName;
}
public void setProjectName( String projectName ) {
this.projectName = projectName;
}
public void setWorkerGroup( String workerGroup ) {
this.workerGroup = workerGroup;
}
public void setEnvironmentCode( float environmentCode ) {
this.environmentCode = environmentCode;
}
public void setFailRetryTimes( float failRetryTimes ) {
this.failRetryTimes = failRetryTimes;
}
public void setFailRetryInterval( float failRetryInterval ) {
this.failRetryInterval = failRetryInterval;
}
public void setTimeoutFlag( String timeoutFlag ) {
this.timeoutFlag = timeoutFlag;
}
public void setTimeoutNotifyStrategy( String timeoutNotifyStrategy ) {
this.timeoutNotifyStrategy = timeoutNotifyStrategy;
}
public void setTimeout( float timeout ) {
this.timeout = timeout;
}
public void setDelayTime( float delayTime ) {
this.delayTime = delayTime;
}
public void setResourceIds( String resourceIds ) {
this.resourceIds = resourceIds;
}
public void setCreateTime( String createTime ) {
this.createTime = createTime;
}
public void setUpdateTime( String updateTime ) {
this.updateTime = updateTime;
}
public void setModifyBy( String modifyBy ) {
this.modifyBy = modifyBy;
}
public void setOperator( float operator ) {
this.operator = operator;
}
public void setOperateTime( String operateTime ) {
this.operateTime = operateTime;
}
public void setDependence( String dependence ) {
this.dependence = dependence;
}
}
public class TaskParamMap {
// Getter Methods
// Setter Methods
}
public class TaskParams {
ArrayList<Object> resourceList = new ArrayList<Object>();
ArrayList<Object> localParams = new ArrayList<Object>();
private String rawScript;
Dependence DependenceObject;
ConditionResult ConditionResultObject;
WaitStartTimeout WaitStartTimeoutObject;
SwitchResult SwitchResultObject;
// Getter Methods
public String getRawScript() {
return rawScript;
}
public Dependence getDependence() {
return DependenceObject;
}
public ConditionResult getConditionResult() {
return ConditionResultObject;
}
public WaitStartTimeout getWaitStartTimeout() {
return WaitStartTimeoutObject;
}
public SwitchResult getSwitchResult() {
return SwitchResultObject;
}
// Setter Methods
public void setRawScript( String rawScript ) {
this.rawScript = rawScript;
}
public void setDependence( Dependence dependenceObject ) {
this.DependenceObject = dependenceObject;
}
public void setConditionResult( ConditionResult conditionResultObject ) {
this.ConditionResultObject = conditionResultObject;
}
public void setWaitStartTimeout( WaitStartTimeout waitStartTimeoutObject ) {
this.WaitStartTimeoutObject = waitStartTimeoutObject;
}
public void setSwitchResult( SwitchResult switchResultObject ) {
this.SwitchResultObject = switchResultObject;
}
}
public class SwitchResult {
// Getter Methods
// Setter Methods
}
public class WaitStartTimeout {
// Getter Methods
// Setter Methods
}
public class ConditionResult {
ArrayList<Object> successNode = new ArrayList<Object>();
ArrayList<Object> failedNode = new ArrayList<Object>();
// Getter Methods
// Setter Methods
}
public class Dependence {
// Getter Methods
// Setter Methods
}
把JSON类的数据放入左边文本框,点击后,自动生成。