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

java.lang.Object
  extended by org.jboss.forge.resources.AbstractResource<T>
All Implemented Interfaces:
Resource<T>
Direct Known Subclasses:
FileResource, VirtualResource

public abstract class AbstractResource<T>
extends Object
implements Resource<T>

Author:
Mike Brock

Field Summary
protected  EnumSet<ResourceFlag> flags
           
protected  Resource<?> parent
           
protected  ResourceFactory resourceFactory
           
 
Constructor Summary
protected AbstractResource(ResourceFactory factory, Resource<?> parent)
           
 
Method Summary
 boolean equals(Object obj)
           
 Set<ResourceFlag> getFlags()
           
 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()
           
 boolean isFlagSet(ResourceFlag flag)
          Return true if the given ResourceFlag is set.
 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.
 void setFlag(ResourceFlag flag)
          Set the given ResourceFlag.
 void unsetFlag(ResourceFlag flag)
          Unset the given ResourceFlag.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.forge.resources.Resource
createFrom, delete, delete, exists, getChild, getName, getResourceInputStream, getUnderlyingResourceObject, listResources
 

Field Detail

resourceFactory

protected final ResourceFactory resourceFactory

parent

protected Resource<?> parent

flags

protected EnumSet<ResourceFlag> flags
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.

setFlag

public void setFlag(ResourceFlag flag)
Description copied from interface: Resource
Set the given ResourceFlag.

Specified by:
setFlag in interface Resource<T>

unsetFlag

public void unsetFlag(ResourceFlag flag)
Description copied from interface: Resource
Unset the given ResourceFlag.

Specified by:
unsetFlag in interface Resource<T>

isFlagSet

public boolean isFlagSet(ResourceFlag flag)
Description copied from interface: Resource
Return true if the given ResourceFlag is set.

Specified by:
isFlagSet in interface Resource<T>

getFlags

public Set<ResourceFlag> getFlags()
Specified by:
getFlags in interface Resource<T>

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>

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


Copyright © 2011 Seam Framework. All Rights Reserved.