com.atlassian.plugin
Class Resources

java.lang.Object
  extended by com.atlassian.plugin.Resources
All Implemented Interfaces:
Resourced

public class Resources
extends java.lang.Object
implements Resourced

An aggregate of all resource descriptors within the given plugin module or plugin.

See Also:
AbstractPlugin.resources, AbstractModuleDescriptor.resources

Nested Class Summary
static class Resources.TypeFilter
           
 
Field Summary
static Resources EMPTY_RESOURCES
           
 
Constructor Summary
Resources(java.lang.Iterable<ResourceDescriptor> resourceDescriptors)
          Create a resource object with the given resource descriptors.
 
Method Summary
static Resources fromXml(org.dom4j.Element element)
          Parses the resource descriptors from the provided plugin XML element and creates a Resources object containing them.
 ResourceDescriptor getResourceDescriptor(java.lang.String type, java.lang.String name)
          Get a ResourceDescriptor of a particular type and name.
 java.util.List<ResourceDescriptor> getResourceDescriptors()
          Get a List of all the descriptors .
 java.util.List<ResourceDescriptor> getResourceDescriptors(java.lang.String type)
          Deprecated. 
 ResourceLocation getResourceLocation(java.lang.String type, java.lang.String name)
          Get a ResourceLocation of a particular type and name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_RESOURCES

public static final Resources EMPTY_RESOURCES
Constructor Detail

Resources

public Resources(java.lang.Iterable<ResourceDescriptor> resourceDescriptors)
          throws java.lang.IllegalArgumentException
Create a resource object with the given resource descriptors. The provided list must not be null.

Parameters:
resourceDescriptors - the descriptors which are part of this resources object
Throws:
java.lang.IllegalArgumentException - if the resourceDescriptors list is null
Method Detail

fromXml

public static Resources fromXml(org.dom4j.Element element)
                         throws PluginParseException,
                                java.lang.IllegalArgumentException
Parses the resource descriptors from the provided plugin XML element and creates a Resources object containing them.

If the module or plugin contains no resource elements, an empty Resources object will be returned. This method will not return null.

Parameters:
element - the plugin or plugin module XML fragment which should not be null
Returns:
a Resources object representing the resources in the plugin or plugin module
Throws:
PluginParseException - if there are two resources with the same name and type in this element, or another parse error occurs
java.lang.IllegalArgumentException - if the provided element is null

getResourceDescriptors

public java.util.List<ResourceDescriptor> getResourceDescriptors()
Description copied from interface: Resourced
Get a List of all the descriptors .

Note: since 2.2 this list must be immutable, previously modifying this list could modify the underlying list.

Specified by:
getResourceDescriptors in interface Resourced
Returns:
all resource descriptors this object supports.

getResourceDescriptors

@Deprecated
public java.util.List<ResourceDescriptor> getResourceDescriptors(java.lang.String type)
Deprecated. 

* @deprecated since 2.5.0 use getResourceDescriptors() and filter as required

Specified by:
getResourceDescriptors in interface Resourced
Returns:
all resource descriptors this object supports.

getResourceLocation

public ResourceLocation getResourceLocation(java.lang.String type,
                                            java.lang.String name)
Description copied from interface: Resourced
Get a ResourceLocation of a particular type and name.

Specified by:
getResourceLocation in interface Resourced
Returns:
the specified resource location if found, null otherwise.

getResourceDescriptor

public ResourceDescriptor getResourceDescriptor(java.lang.String type,
                                                java.lang.String name)
Description copied from interface: Resourced
Get a ResourceDescriptor of a particular type and name.

Specified by:
getResourceDescriptor in interface Resourced
Returns:
the specified resource descriptor if found, null otherwise.


Copyright © 2012 Atlassian. All Rights Reserved.