001/*
002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Anahide Tchertchian
018 */
019package org.nuxeo.targetplatforms.core.descriptors;
020
021import java.util.ArrayList;
022import java.util.List;
023
024import org.nuxeo.common.xmap.annotation.XNodeList;
025import org.nuxeo.common.xmap.annotation.XObject;
026
027/**
028 * Descriptor for target package contributions.
029 *
030 * @since 5.7.1
031 */
032@XObject("package")
033public class TargetPackageDescriptor extends TargetDescriptor {
034
035    @XNodeList(value = "targetPlatforms/platform", type = ArrayList.class, componentType = String.class)
036    public List<String> targetPlatforms;
037
038    @XNodeList(value = "dependencies/package", type = ArrayList.class, componentType = String.class)
039    public List<String> dependencies;
040
041    public List<String> getTargetPlatforms() {
042        return targetPlatforms;
043    }
044
045    public List<String> getDependencies() {
046        return dependencies;
047    }
048
049    @Override
050    public TargetPackageDescriptor clone() {
051        TargetPackageDescriptor clone = new TargetPackageDescriptor();
052        doClone(clone);
053        return clone;
054    }
055
056    protected void doClone(TargetPackageDescriptor clone) {
057        super.doClone(clone);
058        if (targetPlatforms != null) {
059            clone.targetPlatforms = new ArrayList<>(targetPlatforms);
060        }
061        if (dependencies != null) {
062            clone.dependencies = new ArrayList<>(dependencies);
063        }
064    }
065
066}