s.adm.almoctane.sdk.sdk-generate-entity-models-maven-plugin.24.3.source-code.Phases.vm Maven / Gradle / Ivy
package com.hpe.adm.nga.sdk.enums;
import com.hpe.adm.nga.sdk.model.EntityModel;
import com.hpe.adm.nga.sdk.model.StringFieldModel;
import java.util.Arrays;
/**
* Generated class - do not edit!
*/
public final class Phases {
#foreach($phase in ${phaseMap.entrySet()})
#set($phaseType = $phase.getKey())
public enum ${phaseType}Phase {
#foreach($phaseValue in $phase.getValue())
#if($foreach.count > 1), #end${phaseValue[1]}("${phaseValue[0]}")#end;
private final String id;
${phaseType}Phase(final String id) {
this.id = id;
}
public final String getId() {
return id;
}
public static ${phaseType}Phase getPhaseFromId(String id) {
return Arrays.stream(${phaseType}Phase.values()).filter(phase -> phase.id.equals(id)).findFirst().orElse(null);
}
public final EntityModel getAsEntityModel() {
final EntityModel entityModel = new EntityModel();
entityModel.setValue(new StringFieldModel("id", id));
entityModel.setValue(new StringFieldModel("type", "phase"));
return entityModel;
}
public static ${phaseType}Phase getFromEntityModel(final EntityModel entityModel) {
return ${phaseType}Phase.getPhaseFromId(entityModel.getId());
}
}
#end
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy