Skip to content

Commit

Permalink
Now supports IHasID<String>
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Dec 16, 2024
1 parent fc1290a commit d0b3a23
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
import com.helger.commons.error.level.EErrorLevel;
import com.helger.commons.error.level.IErrorLevel;
import com.helger.commons.error.level.IHasErrorLevelComparable;
import com.helger.commons.id.IHasID;
import com.helger.commons.lang.EnumHelper;

/**
* EBMS error severity with mapping to {@link IErrorLevel}.
*
* @author Philip Helger
*/
public enum EEbmsErrorSeverity implements IHasErrorLevelComparable <EEbmsErrorSeverity>
public enum EEbmsErrorSeverity implements IHasID <String>, IHasErrorLevelComparable <EEbmsErrorSeverity>
{
FAILURE ("failure", EErrorLevel.ERROR),
WARNING ("warning", EErrorLevel.WARN);
Expand All @@ -43,6 +45,16 @@ public enum EEbmsErrorSeverity implements IHasErrorLevelComparable <EEbmsErrorSe
m_aErrorLevel = aErrorLevel;
}

/**
* @return The token for the EBMS3 message
*/
@Nonnull
@Nonempty
public String getID ()
{
return m_sSeverity;
}

/**
* @return The token for the EBMS3 message
*/
Expand All @@ -59,6 +71,12 @@ public IErrorLevel getErrorLevel ()
return m_aErrorLevel;
}

@Nullable
public static EEbmsErrorSeverity getFromIDOrNull (@Nullable final String sID)
{
return EnumHelper.getFromIDOrNull (EEbmsErrorSeverity.class, sID);
}

@Nullable
public static EEbmsErrorSeverity getFromErrorLevelOrNull (@Nullable final IErrorLevel aErrorLevel)
{
Expand Down

0 comments on commit d0b3a23

Please sign in to comment.