org.apache.aries.blueprint.reflect.ComponentMetadataImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of blueprint-parser Show documentation
Show all versions of blueprint-parser Show documentation
This bundle contains the blueprint parser in a plain jar.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.aries.blueprint.reflect;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.aries.blueprint.mutable.MutableComponentMetadata;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
/**
* Implementation of ComponentMetadata
*
* @version $Rev: 896324 $, $Date: 2010-01-06 07:05:04 +0100 (Wed, 06 Jan 2010) $
*/
public class ComponentMetadataImpl implements MutableComponentMetadata {
protected String id;
protected int activation = ACTIVATION_EAGER;
protected List dependsOn;
protected ComponentMetadataImpl() {
}
protected ComponentMetadataImpl(ComponentMetadata source) {
id = source.getId();
activation = source.getActivation();
dependsOn = new ArrayList(source.getDependsOn());
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getActivation() {
return activation;
}
public void setActivation(int activation) {
this.activation = activation;
}
public List getDependsOn() {
if (this.dependsOn == null) {
return Collections.emptyList();
} else {
return Collections.unmodifiableList(this.dependsOn);
}
}
public void setDependsOn(List dependsOn) {
this.dependsOn = dependsOn != null ? new ArrayList(dependsOn) : null;
}
public void addDependsOn(String explicitDependency) {
if (this.dependsOn == null) {
this.dependsOn = new ArrayList();
}
this.dependsOn.add(explicitDependency);
}
public void removeDependsOn(String dependency) {
if (this.dependsOn != null) {
this.dependsOn.remove(dependency);
}
}
}