Forge - Resource Addon API 2.0.0.Alpha3

org.jboss.forge.resource
Class AbstractResource<T>

java.lang.Object
  extended by org.jboss.forge.facets.AbstractFaceted<ResourceFacet>
      extended by org.jboss.forge.resource.AbstractResource<T>
All Implemented Interfaces:
org.jboss.forge.facets.Faceted<ResourceFacet>, Resource<T>
Direct Known Subclasses:
AbstractFileResource, VirtualResource

public abstract class AbstractResource<T>
extends org.jboss.forge.facets.AbstractFaceted<ResourceFacet>
implements Resource<T>

Author:
Mike Brock , Ken Finnigan

Field Summary
protected  Resource<?> parent
           
protected  ResourceFactory resourceFactory
           
 
Constructor Summary
protected AbstractResource(ResourceFactory factory, Resource<?> parent)
           
 
Method Summary
protected abstract  List<Resource<?>> doListResources()
          Strategy method for returning child resources.
 boolean equals(Object obj)
           
 String getFullyQualifiedName()
          Return the fully qualified name of the resource (if applicable).
 Resource<?> getParent()
          Get the parent of the current resource.
 ResourceFactory getResourceFactory()
          Return the ResourceFactory with which this Resource was created.
 int hashCode()
           
 List<Resource<?>> listResources()
          Return a list of child resources of the current resource.
 List<Resource<?>> listResources(ResourceFilter filter)
          Return a list of child resources of the current resource matching the given ResourceFilter.
<R extends Resource<?>>
R
reify(Class<R> type)
          Ask this Resource if it is actually a resource of the given type; if it is, return a new reference to the resource as the given type, otherwise return null.
<F extends ResourceFacet>
boolean
supports(F facet)
           
 
Methods inherited from class org.jboss.forge.facets.AbstractFaceted
getFacet, getFacets, getFacets, hasAllFacets, hasAllFacets, hasFacet, install, uninstall
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.forge.resource.Resource
createFrom, delete, delete, exists, getChild, getName, getResourceInputStream, getUnderlyingResourceObject
 
Methods inherited from interface org.jboss.forge.facets.Faceted
getFacet, getFacets, getFacets, hasAllFacets, hasAllFacets, hasFacet, install, uninstall
 

Field Detail

resourceFactory

protected final ResourceFactory resourceFactory

parent

protected Resource<?> parent
Constructor Detail

AbstractResource

protected AbstractResource(ResourceFactory factory,
                           Resource<?> parent)
Method Detail

getResourceFactory

public ResourceFactory getResourceFactory()
Description copied from interface: Resource
Return the ResourceFactory with which this Resource was created. If no factory was used, return null.

Specified by:
getResourceFactory in interface Resource<T>

getFullyQualifiedName

public String getFullyQualifiedName()
Description copied from interface: Resource
Return the fully qualified name of the resource (if applicable). In the case of a file, this would normally be the full path name.

Specified by:
getFullyQualifiedName in interface Resource<T>
Returns:
The fully qualified name.

getParent

public Resource<?> getParent()
Description copied from interface: Resource
Get the parent of the current resource. Returns null if the current resource is the project root.

Specified by:
getParent in interface Resource<T>
Returns:
An instance of the resource parent.

reify

public <R extends Resource<?>> R reify(Class<R> type)
Description copied from interface: Resource
Ask this Resource if it is actually a resource of the given type; if it is, return a new reference to the resource as the given type, otherwise return null.

Specified by:
reify in interface Resource<T>

doListResources

protected abstract List<Resource<?>> doListResources()
Strategy method for returning child resources. Subclasses should implement or override this method.

Returns:

listResources

public List<Resource<?>> listResources()
Description copied from interface: Resource
Return a list of child resources of the current resource.

Specified by:
listResources in interface Resource<T>

listResources

public List<Resource<?>> listResources(ResourceFilter filter)
Description copied from interface: Resource
Return a list of child resources of the current resource matching the given ResourceFilter.

Specified by:
listResources in interface Resource<T>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

supports

public <F extends ResourceFacet> boolean supports(F facet)
Specified by:
supports in interface org.jboss.forge.facets.Faceted<ResourceFacet>

Forge - Resource Addon API 2.0.0.Alpha3

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.