brooklyn.entity.proxying.WrappingEntitySpec Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brooklyn-core Show documentation
Show all versions of brooklyn-core Show documentation
Entity implementation classes, events, and other core elements
package brooklyn.entity.proxying;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import brooklyn.config.ConfigKey;
import brooklyn.entity.Entity;
import brooklyn.policy.Policy;
import brooklyn.util.collections.MutableMap;
import brooklyn.util.collections.MutableSet;
import com.google.common.collect.ImmutableList;
/**
* @deprecated since 0.6; use {@link EntitySpec#create(EntitySpec)}
*
* @author aled
*/
public class WrappingEntitySpec extends BasicEntitySpec> {
private final EntitySpec extends T> delegate;
public static WrappingEntitySpec newInstance(EntitySpec extends T> delegate) {
return new WrappingEntitySpec(delegate);
}
public WrappingEntitySpec(EntitySpec extends T> delegate) {
super((Class)delegate.getType());
this.delegate = delegate;
}
@Override
public Class extends T> getImplementation() {
return (super.getImplementation() == null) ? delegate.getImplementation() : super.getImplementation();
}
@Override
public Set> getAdditionalInterfaces() {
return Collections.unmodifiableSet(MutableSet.>builder()
.addAll(super.getAdditionalInterfaces())
.addAll(delegate.getAdditionalInterfaces())
.build());
}
@Override
public List getInitializers() {
return ImmutableList.builder()
.addAll(super.getInitializers())
.addAll(delegate.getInitializers())
.build();
}
@Override
public Entity getParent() {
return (super.getParent() == null) ? delegate.getParent() : super.getParent();
}
@Override
public String getDisplayName() {
return (super.getDisplayName() == null) ? delegate.getDisplayName() : super.getDisplayName();
}
@Override
public List getPolicies() {
return ImmutableList.builder()
.addAll(delegate.getPolicies())
.addAll(super.getPolicies())
.build();
}
@Override
public Map getFlags() {
return Collections.unmodifiableMap(MutableMap.builder()
.putAll(delegate.getFlags())
.putAll(super.getFlags())
.build());
}
public Map, Object> getConfig() {
return Collections.unmodifiableMap(MutableMap.,Object>builder()
.putAll(delegate.getConfig())
.putAll(super.getConfig())
.build());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy