Skip to content

Method: getStartPosition()

1: package de.fhdw.wtf.common.exception.walker;
2:
3: import de.fhdw.wtf.common.exception.editor.EditorMarkable;
4: import de.fhdw.wtf.common.exception.editor.EditorMarker;
5: import de.fhdw.wtf.common.token.Position;
6: import de.fhdw.wtf.common.token.Token;
7:
8: public final class InvalidProductException extends TaskException implements EditorMarkable {
9:         
10:         /**
11:          * generated.
12:          */
13:         private static final long serialVersionUID = -1525101684836730523L;
14:         private final Token firstToken;
15:         private final Token lastToken;
16:         
17:         private InvalidProductException(final String name, final Token firstToken, final Token lastToken) {
18:                 super(de.fhdw.wtf.common.constants.walker.ExceptionConstants.INVALID_PRODUCT_MESSAGE + name);
19:                 this.firstToken = firstToken;
20:                 this.lastToken = lastToken;
21:         }
22:         
23:         public static InvalidProductException create(final String name, final Token firstToken, final Token lastToken) {
24:                 return new InvalidProductException(name, firstToken, lastToken);
25:         }
26:         
27:         @Override
28:         public Position getStartPosition() {
29:                 return this.firstToken.getPosition();
30:         }
31:         
32:         @Override
33:         public String getDescription() {
34:                 return this.getMessage();
35:         }
36:         
37:         @Override
38:         public Position getEndPos() {
39:                 return this.lastToken.getPosition();
40:         }
41:         
42:         @Override
43:         public EditorMarker getMarker() {
44:                 return EditorMarker.INVALID_PRODUCT_MARKER;
45:         }
46: }