| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2008, 2017 IBM Corporation and others. |
| 3 |
* |
| 4 |
* This program and the accompanying materials |
| 5 |
* are made available under the terms of the Eclipse Public License 2.0 |
| 6 |
* which accompanies this distribution, and is available at |
| 7 |
* https://www.eclipse.org/legal/epl-2.0/ |
| 8 |
* |
| 9 |
* SPDX-License-Identifier: EPL-2.0 |
| 10 |
* |
| 11 |
* Contributors: |
| 12 |
* IBM Corporation - initial API and implementation |
| 13 |
*******************************************************************************/ |
| 14 |
package org.eclipse.equinox.internal.p2.metadata; |
| 15 |
|
| 16 |
import java.net.URI; |
| 17 |
import org.eclipse.equinox.p2.metadata.ICopyright; |
| 18 |
|
| 19 |
/** |
| 20 |
* The <code>Copyright</code> class represents a software copyright. A copyright has |
| 21 |
* required body text which may be the full text or a summary. An optional location field can be specified |
| 22 |
* which links to full text. |
| 23 |
*/ |
| 24 |
public class Copyright implements ICopyright { |
| 25 |
/** |
| 26 |
* The <code>body</code> contains the descriptive text for the copyright. This may |
| 27 |
* be a summary for a copyright specified in a URL. |
| 28 |
*/ |
| 29 |
private final String body; |
| 30 |
|
| 31 |
/** |
| 32 |
* The <code>location</code> is the location of a document containing a copyright notice. |
| 33 |
*/ |
| 34 |
private URI location; |
| 35 |
|
| 36 |
/** |
| 37 |
* Creates a new copyright. The body must contain the full text of the copyright. |
| 38 |
* |
| 39 |
* @param location the location of a document containing the copyright notice, or <code>null</code> |
| 40 |
* @param body the copyright body, cannot be <code>null</code> |
| 41 |
* @throws IllegalArgumentException when the <code>body</code> is <code>null</code> |
| 42 |
*/ |
| 43 |
public Copyright(URI location, String body) { |
| 44 |
if (body == null) |
| 45 |
throw new IllegalArgumentException("body cannot be null"); //$NON-NLS-1$ |
| 46 |
this.location = location; |
| 47 |
this.body = body; |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Returns the location of a document containing the copyright notice. |
| 52 |
* |
| 53 |
* @return The location of the copyright notice, or <code>null</code> |
| 54 |
*/ |
| 55 |
@Override |
| 56 |
public URI getLocation() { |
| 57 |
return location; |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* Returns the license body. |
| 62 |
* |
| 63 |
* @return the license body, never <code>null</code> |
| 64 |
*/ |
| 65 |
@Override |
| 66 |
public String getBody() { |
| 67 |
return body; |
| 68 |
} |
| 69 |
} |