001package org.apache.maven.model.building;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.commons.lang3.Validate;
023import org.apache.maven.model.InputLocation;
024import org.apache.maven.model.building.ModelProblem.Severity;
025import org.apache.maven.model.building.ModelProblem.Version;
026
027/**
028 * Class to wrap request parameters to ModelProblemCollector.addProblem
029 *
030 * @author mkleint
031 */
032public final class ModelProblemCollectorRequest
033{
034
035    private final ModelProblem.Severity severity;
036    private final ModelProblem.Version version;
037    private Exception exception;
038    private String message;
039    private InputLocation location;
040
041    /**
042     * Create a new request with mandatory parameters.
043     * @param severity
044     * @param version
045     */
046    public ModelProblemCollectorRequest( Severity severity, Version version )
047    {
048        this.severity = Validate.notNull( severity, "severity cannot be null" );
049        this.version = Validate.notNull( version, "version cannot be null" );
050    }
051
052    public Severity getSeverity()
053    {
054        return severity;
055    }
056
057    public Version getVersion()
058    {
059        return version;
060    }
061
062    public Exception getException()
063    {
064        return exception;
065    }
066
067    public ModelProblemCollectorRequest setException( Exception exception )
068    {
069        this.exception = exception;
070        return this;
071    }
072
073    public String getMessage()
074    {
075        return message;
076    }
077
078    public ModelProblemCollectorRequest setMessage( String message )
079    {
080        this.message = message;
081        return this;
082    }
083
084    public InputLocation getLocation()
085    {
086        return location;
087    }
088
089    public ModelProblemCollectorRequest setLocation( InputLocation location )
090    {
091        this.location = location;
092        return this;
093    }
094}