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 */
017package org.apache.juneau.bean.jsonapi;
018
019import org.apache.juneau.marshall.*;
020import org.apache.juneau.marshall.marshaller.*;
021
022/**
023 * Represents the {@code source} sub-object of a JSON:API Error Object.
024 *
025 * <p>
026 * Per <a href="https://jsonapi.org/format/#error-objects">JSON:API v1.1 &#167; Error Objects</a>, the
027 * {@code source} object can carry a {@code pointer} (JSON Pointer to the offending element), a
028 * {@code parameter} (the URI query parameter name), and/or a {@code header} (the request header name).
029 */
030@Marshalled
031public class JsonApiErrorSource {
032
033   private String pointer;
034   private String parameter;
035   private String header;
036
037   /**
038    * Default constructor.
039    */
040   public JsonApiErrorSource() { /* intentionally empty */ }
041
042   /**
043    * Bean property getter:  <property>pointer</property>.
044    *
045    * @return The value of the <property>pointer</property> property, or <jk>null</jk> if it is not set.
046    */
047   public String getPointer() { return pointer; }
048
049   /**
050    * Bean property setter:  <property>pointer</property>.
051    *
052    * @param value The new value for this property.  Can be <jk>null</jk> to unset the property.
053    * @return This object.
054    */
055   public JsonApiErrorSource setPointer(String value) {
056      pointer = value;
057      return this;
058   }
059
060   /**
061    * Bean property getter:  <property>parameter</property>.
062    *
063    * @return The value of the <property>parameter</property> property, or <jk>null</jk> if it is not set.
064    */
065   public String getParameter() { return parameter; }
066
067   /**
068    * Bean property setter:  <property>parameter</property>.
069    *
070    * @param value The new value for this property.  Can be <jk>null</jk> to unset the property.
071    * @return This object.
072    */
073   public JsonApiErrorSource setParameter(String value) {
074      parameter = value;
075      return this;
076   }
077
078   /**
079    * Bean property getter:  <property>header</property>.
080    *
081    * @return The value of the <property>header</property> property, or <jk>null</jk> if it is not set.
082    */
083   public String getHeader() { return header; }
084
085   /**
086    * Bean property setter:  <property>header</property>.
087    *
088    * @param value The new value for this property.  Can be <jk>null</jk> to unset the property.
089    * @return This object.
090    */
091   public JsonApiErrorSource setHeader(String value) {
092      header = value;
093      return this;
094   }
095
096   @Override /* Overridden from Object */
097   public String toString() {
098      return Json.of(this);
099   }
100}