01: /*
02:
03: Licensed to the Apache Software Foundation (ASF) under one or more
04: contributor license agreements. See the NOTICE file distributed with
05: this work for additional information regarding copyright ownership.
06: The ASF licenses this file to You under the Apache License, Version 2.0
07: (the "License"); you may not use this file except in compliance with
08: the License. You may obtain a copy of the License at
09:
10: http://www.apache.org/licenses/LICENSE-2.0
11:
12: Unless required by applicable law or agreed to in writing, software
13: distributed under the License is distributed on an "AS IS" BASIS,
14: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: See the License for the specific language governing permissions and
16: limitations under the License.
17:
18: */
19: package org.apache.batik.anim;
20:
21: import org.apache.batik.anim.timing.TimedElement;
22:
23: /**
24: * An exception class for SMIL animation exceptions.
25: *
26: * @author <a href="mailto:cam%40mcc%2eid%2eau">Cameron McCormack</a>
27: * @version $Id: AnimationException.java 475954 2006-11-16 22:34:04Z cam $
28: */
29: public class AnimationException extends RuntimeException {
30:
31: /**
32: * The timed element on which the error occurred.
33: */
34: protected TimedElement e;
35:
36: /**
37: * The error code.
38: */
39: protected String code;
40:
41: /**
42: * The parameters to use for the error message.
43: */
44: protected Object[] params;
45:
46: /**
47: * The message.
48: */
49: protected String message;
50:
51: /**
52: * Creates a new AnimationException.
53: * @param e the animation element on which the error occurred
54: * @param code the error code
55: * @param params the parameters to use for the error message
56: */
57: public AnimationException(TimedElement e, String code,
58: Object[] params) {
59: this .e = e;
60: this .code = code;
61: this .params = params;
62: }
63:
64: /**
65: * Returns the timed element that caused this animation exception.
66: */
67: public TimedElement getElement() {
68: return e;
69: }
70:
71: /**
72: * Returns the error code.
73: */
74: public String getCode() {
75: return code;
76: }
77:
78: /**
79: * Returns the error message parameters.
80: */
81: public Object[] getParams() {
82: return params;
83: }
84:
85: /**
86: * Returns the error message according to the error code and parameters.
87: */
88: public String getMessage() {
89: return TimedElement.formatMessage(code, params);
90: }
91: }
|