/*
 * 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.pojos;

import java.net.URI;
import java.util.List;

public class PojoB {

    private List<Object> objects;
    private URI uri;
    private int number;
    private BeanD bean;
    
    private boolean initCalled;
    private boolean destroyCalled;
    
    public PojoB() {
    }
    
    public PojoB(URI uri, int number) {
        this.uri = uri;
        this.number = number;
    }

    public URI getUri() {
        return uri;
    }

    public void setUri(URI uri) {
        this.uri = uri;
    }

    public List<Object> getObjects() {
        return objects;
    }

    public void setObjects(List<Object> objects) {
        this.objects = objects;
    }

    public void init() {
        initCalled = true;
    }
    
    public boolean getInitCalled() {
        return initCalled;
    }
    
    public void destroy() {
        destroyCalled = true;
    }
    
    public boolean getDestroyCalled() {
        return destroyCalled;
    }
    
    public int getNumber() {
        return number;
    }
    
    public BeanD getBean() {
        if (bean == null) {
            bean = new BeanD();
        }
        return bean;
    }
    
    public static PojoB createStatic(URI uri, int number) {
        return new PojoB(URI.create(uri + "-static"), number);
    }
    
    public PojoB createDynamic(URI uri, int number) {
        return new PojoB(URI.create(uri + "-dynamic"), number);
    }
}
