Forge - Resource Addon Impl 2.0.0.Alpha3

org.jboss.forge.resource
Class DirectoryResourceImpl

java.lang.Object
  extended by org.jboss.forge.facets.AbstractFaceted<ResourceFacet>
      extended by org.jboss.forge.resource.AbstractResource<File>
          extended by org.jboss.forge.resource.AbstractFileResource<DirectoryResource>
              extended by org.jboss.forge.resource.DirectoryResourceImpl
All Implemented Interfaces:
org.jboss.forge.facets.Faceted<ResourceFacet>, DirectoryResource, FileResource<DirectoryResource>, Resource<File>

public class DirectoryResourceImpl
extends AbstractFileResource<DirectoryResource>
implements DirectoryResource

A standard, build-in, resource for representing directories on the file-system.

Author:
Mike Brock, Lincoln Baxter, III

Field Summary
 
Fields inherited from class org.jboss.forge.resource.AbstractFileResource
file, lastModification
 
Fields inherited from class org.jboss.forge.resource.AbstractResource
parent, resourceFactory
 
Constructor Summary
DirectoryResourceImpl(ResourceFactory factory, File file)
           
 
Method Summary
 DirectoryResourceImpl createFrom(File file)
           
 DirectoryResourceImpl createTempResource()
           
protected  List<Resource<?>> doListResources()
           
 boolean equals(Object obj)
           
 Resource<?> getChild(String name)
          Obtain a reference to the child resource.
 DirectoryResourceImpl getChildDirectory(String name)
          Obtain a reference to the child DirectoryResourceImpl.
<E,T extends Resource<E>>
T
getChildOfType(Class<T> type, String name)
          Using the given type, obtain a reference to the child resource of the given type.
 String getName()
           
 DirectoryResourceImpl getOrCreateChildDirectory(String name)
           
 Resource<?> getParent()
           
 long getSize()
           
 
Methods inherited from class org.jboss.forge.resource.AbstractFileResource
createNewFile, delete, delete, deleteOnExit, exists, getResourceInputStream, getUnderlyingResourceObject, isDirectory, isExecutable, isReadable, isStale, isWritable, markUpToDate, mkdir, mkdirs, reify, renameTo, renameTo, setContents, setContents, setContents, toString
 
Methods inherited from class org.jboss.forge.resource.AbstractResource
getFullyQualifiedName, getResourceFactory, hashCode, listResources, listResources, supports
 
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, wait, wait, wait
 
Methods inherited from interface org.jboss.forge.resource.FileResource
createNewFile, deleteOnExit, isDirectory, isExecutable, isReadable, isStale, isWritable, markUpToDate, mkdir, mkdirs, renameTo, renameTo, setContents, setContents, setContents
 
Methods inherited from interface org.jboss.forge.resource.Resource
delete, delete, exists, getFullyQualifiedName, getResourceFactory, getResourceInputStream, getUnderlyingResourceObject, listResources, listResources, reify
 
Methods inherited from interface org.jboss.forge.facets.Faceted
getFacet, getFacets, getFacets, hasAllFacets, hasAllFacets, hasFacet, install, supports, uninstall
 

Constructor Detail

DirectoryResourceImpl

public DirectoryResourceImpl(ResourceFactory factory,
                             File file)
Method Detail

doListResources

protected List<Resource<?>> doListResources()
Specified by:
doListResources in class AbstractResource<File>

getChild

public Resource<?> getChild(String name)
Obtain a reference to the child resource.

Specified by:
getChild in interface Resource<File>
Overrides:
getChild in class AbstractFileResource<DirectoryResource>

getChildDirectory

public DirectoryResourceImpl getChildDirectory(String name)
                                        throws ResourceException
Obtain a reference to the child DirectoryResourceImpl. If that resource does not exist, return a new instance. If the resource exists and is not a DirectoryResourceImpl, throw ResourceException

Specified by:
getChildDirectory in interface DirectoryResource
Throws:
ResourceException

getOrCreateChildDirectory

public DirectoryResourceImpl getOrCreateChildDirectory(String name)
Specified by:
getOrCreateChildDirectory in interface DirectoryResource

getChildOfType

public <E,T extends Resource<E>> T getChildOfType(Class<T> type,
                                                  String name)
                                     throws ResourceException
Using the given type, obtain a reference to the child resource of the given type. If the result is not of the requested type and does not exist, return null. If the result is not of the requested type and exists, throw ResourceException

Specified by:
getChildOfType in interface DirectoryResource
Throws:
ResourceException

createTempResource

public DirectoryResourceImpl createTempResource()
Specified by:
createTempResource in interface FileResource<DirectoryResource>
Overrides:
createTempResource in class AbstractFileResource<DirectoryResource>

createFrom

public DirectoryResourceImpl createFrom(File file)
Specified by:
createFrom in interface Resource<File>
Specified by:
createFrom in class AbstractFileResource<DirectoryResource>

getParent

public Resource<?> getParent()
Specified by:
getParent in interface Resource<File>
Overrides:
getParent in class AbstractFileResource<DirectoryResource>

getName

public String getName()
Specified by:
getName in interface Resource<File>
Overrides:
getName in class AbstractFileResource<DirectoryResource>

equals

public boolean equals(Object obj)
Overrides:
equals in class AbstractResource<File>

getSize

public long getSize()
Specified by:
getSize in interface FileResource<DirectoryResource>
Overrides:
getSize in class AbstractFileResource<DirectoryResource>

Forge - Resource Addon Impl 2.0.0.Alpha3

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