001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.eclipse.aether.spi.connector.transport.http.RFC9457;
020
021import java.net.URI;
022
023public class RFC9457Payload {
024    public static final RFC9457Payload INSTANCE = new RFC9457Payload();
025
026    private final URI type;
027
028    private final Integer status;
029
030    private final String title;
031
032    private final String detail;
033
034    private final URI instance;
035
036    private RFC9457Payload() {
037        this(null, null, null, null, null);
038    }
039
040    public RFC9457Payload(
041            final URI type, final Integer status, final String title, final String detail, final URI instance) {
042        this.type = type;
043        this.status = status;
044        this.title = title;
045        this.detail = detail;
046        this.instance = instance;
047    }
048
049    public URI getType() {
050        return type;
051    }
052
053    public Integer getStatus() {
054        return status;
055    }
056
057    public String getTitle() {
058        return title;
059    }
060
061    public String getDetail() {
062        return detail;
063    }
064
065    public URI getInstance() {
066        return instance;
067    }
068
069    @Override
070    public String toString() {
071        StringBuilder builder = new StringBuilder();
072        builder.append("RFC9457Payload [");
073        if (type != null) {
074            builder.append("type=").append(type).append(", ");
075        }
076        if (status != null) {
077            builder.append("status=").append(status).append(", ");
078        }
079        if (title != null) {
080            builder.append("title=").append(title).append(", ");
081        }
082        if (detail != null) {
083            builder.append("detail=").append(detail).append(", ");
084        }
085        if (instance != null) {
086            builder.append("instance=").append(instance);
087        }
088        builder.append("]");
089        return builder.toString();
090    }
091}