1 /*******************************************************************************
2 * Copyright (c) 2012 Sonatype, Inc.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Sonatype, Inc. - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.aether
.resolution
;
13 import org
.eclipse
.aether
.artifact
.Artifact
;
16 * A query for the error policy for a given artifact's descriptor.
18 * @see ArtifactDescriptorPolicy
20 public final class ArtifactDescriptorPolicyRequest
23 private Artifact artifact
;
25 private String context
= "";
28 * Creates an uninitialized request.
30 public ArtifactDescriptorPolicyRequest()
32 // enables default constructor
36 * Creates a request for the specified artifact.
38 * @param artifact The artifact for whose descriptor to determine the error policy, may be {@code null}.
39 * @param context The context in which this request is made, may be {@code null}.
41 public ArtifactDescriptorPolicyRequest( Artifact artifact
, String context
)
43 setArtifact( artifact
);
44 setRequestContext( context
);
48 * Gets the artifact for whose descriptor to determine the error policy.
50 * @return The artifact for whose descriptor to determine the error policy or {@code null} if not set.
52 public Artifact
getArtifact()
58 * Sets the artifact for whose descriptor to determine the error policy.
60 * @param artifact The artifact for whose descriptor to determine the error policy, may be {@code null}.
61 * @return This request for chaining, never {@code null}.
63 public ArtifactDescriptorPolicyRequest
setArtifact( Artifact artifact
)
65 this.artifact
= artifact
;
70 * Gets the context in which this request is made.
72 * @return The context, never {@code null}.
74 public String
getRequestContext()
80 * Sets the context in which this request is made.
82 * @param context The context, may be {@code null}.
83 * @return This request for chaining, never {@code null}.
85 public ArtifactDescriptorPolicyRequest
setRequestContext( String context
)
87 this.context
= ( context
!= null ) ? context
: "";
92 public String
toString()
94 return String
.valueOf( getArtifact() );