donaldp 2002/06/08 17:25:53
Added: containerkit/src/java/org/apache/excalibur/containerkit/metainfo
FeatureDescriptor.java
Log:
Add in abstract class that all "feature" descriptors
should extend.
Revision Changes Path
1.1
jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/metainfo/FeatureDescriptor.java
Index: FeatureDescriptor.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.containerkit.metainfo;
import java.util.Properties;
/**
* This is the Abstract class for all feature feature descriptors.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
* @version $Revision: 1.1 $ $Date: 2002/06/09 00:25:53 $
*/
public abstract class FeatureDescriptor
{
private static final String[] EMPTY_SET = new String[0];
/**
* The arbitrary set of attributes associated with Component.
*/
private final Properties m_attributes;
protected FeatureDescriptor( final Properties attributes )
{
m_attributes = attributes;
}
/**
* Return the attribute for specified key.
*
* @return the attribute for specified key.
*/
public String getAttribute( final String key )
{
if( null == m_attributes )
{
return null;
}
else
{
return m_attributes.getProperty( key );
}
}
/**
* Return the attribute for specified key.
*
* @return the attribute for specified key.
*/
public String getAttribute( final String key,
final String defaultValue )
{
if( null == m_attributes )
{
return defaultValue;
}
else
{
return m_attributes.getProperty( key, defaultValue );
}
}
/**
* Returns the set of attribute names available under this descriptor.
*
* @return an array of the properties names held by the descriptor.
*/
public String[] getAttributeNames()
{
if( null == m_attributes )
{
return EMPTY_SET;
}
else
{
return (String[]) m_attributes.keySet().toArray( EMPTY_SET );
}
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>