001/*
002 * ModeShape (http://www.modeshape.org)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *       http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.modeshape.schematic.internal.schema;
017
018import org.modeshape.schematic.SchemaLibrary;
019import org.modeshape.schematic.document.JsonSchema.Type;
020import org.modeshape.schematic.document.Path;
021
022public final class ValidationTypeMismatchProblem extends ValidationProblem implements SchemaLibrary.MismatchedTypeProblem {
023    private final Object actualValue;
024    private final Object convertedValue;
025    private final Type actualType;
026    private final Type expectedType;
027
028    public ValidationTypeMismatchProblem( SchemaLibrary.ProblemType type,
029                                          Path path,
030                                          Object actualValue,
031                                          Type actualType,
032                                          Type expectedType,
033                                          Object convertedValue,
034                                          String reason,
035                                          Throwable cause ) {
036        super(type, path, reason, cause);
037        this.actualValue = actualValue;
038        this.convertedValue = convertedValue;
039        this.actualType = actualType;
040        this.expectedType = expectedType;
041    }
042
043    @Override
044    public Object getActualValue() {
045        return actualValue;
046    }
047
048    @Override
049    public Object getConvertedValue() {
050        return convertedValue;
051    }
052
053    @Override
054    public Type getActualType() {
055        return actualType;
056    }
057
058    @Override
059    public Type getExpectedType() {
060        return expectedType;
061    }
062
063    @Override
064    public String toString() {
065        return super.toString();
066    }
067}