View Javadoc

1   package cz.cuni.amis.pogamut.sposh.exceptions;
2   
3   import cz.cuni.amis.pogamut.sposh.elements.ParseException;
4   import cz.cuni.amis.pogamut.sposh.elements.PoshElement;
5   import java.text.MessageFormat;
6   
7   /**
8    * Thrown when name in the lap plan is not valid (example: it includes
9    * whitespaces). Names of {@link PoshElement data nodes} in the lap plan must be
10   * parsable (since we are putting them into a text file), so when user tries to
11   * pass incorrect name (e.g. starts with number, has whitespaces, braces...)
12   *
13   * XXX: How exactly are names defined? Certainly not java identifier (thx2 '-'),
14   * just regexp in the parser?
15   *
16   * @author Honza
17   */
18  public class InvalidNameException extends ParseException{
19  
20      /**
21       * Create an exception about invalid name
22       * @param name invalid name
23       * @return created exception
24       */
25      public static InvalidNameException create(String name) {
26          String msg = MessageFormat.format("Name '{0}' is not valid.", name);
27          return new InvalidNameException(msg);
28      }
29  
30      public InvalidNameException(String message) {
31          super(message);
32      }
33  
34  }