001 /***************************************************************************** 002 * Copyright (C) PicoContainer Organization. All rights reserved. * 003 * ------------------------------------------------------------------------- * 004 * The software in this package is published under the terms of the BSD * 005 * style license a copy of which has been included with this distribution in * 006 * the LICENSE.txt file. * 007 * * 008 * Original code by * 009 *****************************************************************************/ 010 package org.picocontainer.script.xml; 011 012 import org.w3c.dom.Element; 013 import static org.picocontainer.script.xml.AttributeUtils.*; 014 import static org.picocontainer.script.xml.XMLConstants.*; 015 016 /** 017 * Extensible way to bundle up attributes for the container 018 * XML node. 019 * @author Mike Rimov 020 * 021 */ 022 public class ContainerOptions { 023 024 private final Element rootElement; 025 026 public ContainerOptions(Element rootElement) { 027 this.rootElement = rootElement; 028 } 029 030 031 public boolean isInheritParentBehaviors() { 032 return boolValue(rootElement.getAttribute(INHERIT_BEHAVIORS_ATTRIBUTE), false); 033 034 } 035 036 public boolean isCaching() { 037 return boolValue(rootElement.getAttribute(CACHING_ATTRIBUTE), true); 038 } 039 040 public String getMonitorName() { 041 return rootElement.getAttribute(COMPONENT_MONITOR); 042 } 043 044 public String getComponentFactoryName() { 045 return rootElement.getAttribute(COMPONENT_ADAPTER_FACTORY); 046 } 047 048 }