001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    package org.apache.geronimo.validator;
018    
019    
020    public class ValidationException extends java.lang.Exception {
021    
022        protected static Messages messages = new Messages("");
023    
024        protected Object[] details;
025        protected String message;
026    
027        protected String prefix;
028    
029    
030        public ValidationException(String message) {
031            this.message = message;
032        }
033    
034        public void setDetails(Object arg1) {
035            this.details = new Object[]{arg1};
036        }
037    
038        public void setDetails(Object arg1, Object arg2) {
039            this.details = new Object[]{arg1, arg2};
040        }
041    
042        public void setDetails(Object arg1, Object arg2, Object arg3) {
043            this.details = new Object[]{arg1, arg2, arg3};
044        }
045    
046        public void setDetails(Object arg1, Object arg2, Object arg3, Object arg4) {
047            this.details = new Object[]{arg1, arg2, arg3, arg4};
048        }
049    
050        public void setDetails(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
051            this.details = new Object[]{arg1, arg2, arg3, arg4, arg5};
052        }
053    
054        public void setDetails(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
055            this.details = new Object[]{arg1, arg2, arg3, arg4, arg5, arg6};
056        }
057    
058        public Object[] getDetails() {
059            return details;
060        }
061    
062        public String getSummary() {
063            return getMessage(1);
064        }
065    
066        public String getMessage() {
067            return getMessage(2);
068        }
069    
070        public String getMessage(int level) {
071            return messages.format(level + "." + message, details);
072        }
073    
074        public String getPrefix() {
075            return "";
076        }
077    
078        public String getCategory() {
079            return "";
080        }
081    
082    }