com.atlassian.plugin
Class Resources

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

public class Resources
extends 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(Iterable<ResourceDescriptor> resourceDescriptors)
          Deprecated. Since 3.0.1, use fromXml(org.dom4j.Element) instead. This will lazily create the ResourceDescriptors from the Element, for a memory saving.
 
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(String type, String name)
          Get a ResourceDescriptor of a particular type and name.
 List<ResourceDescriptor> getResourceDescriptors()
          Get a List of all the descriptors .
 List<ResourceDescriptor> getResourceDescriptors(String type)
          Deprecated. 
 ResourceLocation getResourceLocation(String type, 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

@Deprecated
public Resources(Iterable<ResourceDescriptor> resourceDescriptors)
          throws IllegalArgumentException
Deprecated. Since 3.0.1, use fromXml(org.dom4j.Element) instead. This will lazily create the ResourceDescriptors from the Element, for a memory saving.

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:
IllegalArgumentException - if the resourceDescriptors list is null
Method Detail

fromXml

public static Resources fromXml(org.dom4j.Element element)
                         throws PluginParseException,
                                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
IllegalArgumentException - if the provided element is null

getResourceDescriptors

public 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 List<ResourceDescriptor> getResourceDescriptors(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(String type,
                                            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(String type,
                                                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 © 2015 Atlassian. All rights reserved.