All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.epubcheck.messages.OverriddenMessageDictionary Maven / Gradle / Ivy

Go to download

EPUBCheck is a tool to validate the conformance of EPUB publications against the EPUB specifications. EPUBCheck can be run as a standalone command-line tool or used as a Java library.

There is a newer version: 5.1.0
Show newest version
package com.adobe.epubcheck.messages;

import com.adobe.epubcheck.api.Report;
import java.io.File;

/**
 * Maps a message to a severity using overrides provided in a file. Falls back
 * to default messages and severities when an override isn't available.
 */
public class OverriddenMessageDictionary implements MessageDictionary
{
  private final OverriddenMessages messages;

  public OverriddenMessageDictionary(File overrideFile, Report report )
  {
    messages = new OverriddenMessages(overrideFile, report);
  }
  
  @Override
  public Message getMessage(MessageId id)
  {
     Message message = messages.getMessage(id);
     if( message == null ) 
     {
       // Failure to find the message is a programmer error.
       throw new IllegalArgumentException(String.format("MessageId %s is not valid.", id.name()));
     }
     
     return message;
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy