Forge - Parent 1.1.2-SNAPSHOT

org.jboss.forge.resources.java
Class JavaFieldResource

java.lang.Object
  extended by org.jboss.forge.resources.AbstractResource<T>
      extended by org.jboss.forge.resources.VirtualResource<T>
          extended by org.jboss.forge.resources.java.JavaMemberResource<Field<? extends JavaSource<?>>>
              extended by org.jboss.forge.resources.java.JavaFieldResource
All Implemented Interfaces:
DeletionAware, Resource<Field<? extends JavaSource<?>>>

public class JavaFieldResource
extends JavaMemberResource<Field<? extends JavaSource<?>>>
implements DeletionAware

Author:
Lincoln Baxter, III

Field Summary
 
Fields inherited from class org.jboss.forge.resources.AbstractResource
flags, parent, resourceFactory
 
Constructor Summary
JavaFieldResource(JavaResource parent, Field<? extends JavaSource<?>> field)
           
 
Method Summary
 Resource<Field<? extends JavaSource<?>>> createFrom(Field<? extends JavaSource<?>> file)
          Create a new resource instance for the target resource reference of the type that this current resource is.
 boolean delete()
          Delete this resource, return true if successful, false if not.
 boolean delete(boolean recursive)
          Delete this resource, return true if successful, false if not.
protected  List<Resource<?>> doListResources()
          Strategy method for returning child resources.
 String getName()
          Return the common name of the resource.
 List<Resource<?>> getOptionalResources()
          Returns a List of additional Resource instances.
 List<Resource<?>> getResources()
          Returns a List of additional Resource instances.
 Field<? extends JavaSource<?>> getUnderlyingResourceObject()
          Get the underlying object represented by this Resource
 String toString()
           
 
Methods inherited from class org.jboss.forge.resources.VirtualResource
exists, getChild, getResourceInputStream
 
Methods inherited from class org.jboss.forge.resources.AbstractResource
equals, getFlags, getFullyQualifiedName, getParent, getResourceFactory, hashCode, isFlagSet, listResources, listResources, reify, setFlag, unsetFlag
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaFieldResource

public JavaFieldResource(JavaResource parent,
                         Field<? extends JavaSource<?>> field)
Method Detail

createFrom

public Resource<Field<? extends JavaSource<?>>> createFrom(Field<? extends JavaSource<?>> file)
Description copied from interface: Resource
Create a new resource instance for the target resource reference of the type that this current resource is.

Specified by:
createFrom in interface Resource<Field<? extends JavaSource<?>>>
Overrides:
createFrom in class JavaMemberResource<Field<? extends JavaSource<?>>>
Parameters:
file - The target reference to create the resource instance from.
Returns:
A new resource.

doListResources

protected List<Resource<?>> doListResources()
Description copied from class: AbstractResource
Strategy method for returning child resources. Subclasses should implement or override this method.

Overrides:
doListResources in class JavaMemberResource<Field<? extends JavaSource<?>>>
Returns:

getUnderlyingResourceObject

public Field<? extends JavaSource<?>> getUnderlyingResourceObject()
Description copied from interface: Resource
Get the underlying object represented by this Resource

Specified by:
getUnderlyingResourceObject in interface Resource<Field<? extends JavaSource<?>>>
Overrides:
getUnderlyingResourceObject in class JavaMemberResource<Field<? extends JavaSource<?>>>

getName

public String getName()
Description copied from interface: Resource
Return the common name of the resource. If it's a file, for instance, just the file name.

Specified by:
getName in interface Resource<Field<? extends JavaSource<?>>>
Overrides:
getName in class JavaMemberResource<Field<? extends JavaSource<?>>>
Returns:
The name of the resource.

toString

public String toString()
Overrides:
toString in class JavaMemberResource<Field<? extends JavaSource<?>>>

delete

public boolean delete()
               throws UnsupportedOperationException
Description copied from interface: Resource
Delete this resource, return true if successful, false if not.

Specified by:
delete in interface Resource<Field<? extends JavaSource<?>>>
Throws:
UnsupportedOperationException - if deleting is not supported by the underlying implementation.

delete

public boolean delete(boolean recursive)
               throws UnsupportedOperationException
Description copied from interface: Resource
Delete this resource, return true if successful, false if not.

Specified by:
delete in interface Resource<Field<? extends JavaSource<?>>>
Parameters:
recursive - if false and this resource both supports recursive deletion and contains children, deletion will not occur; otherwise, if true, deletion will propagate to all child resources. Implementations may choose simply to delegate to Resource.delete()
Throws:
UnsupportedOperationException - if deleting is not supported by the underlying implementation.

getResources

public List<Resource<?>> getResources()
Description copied from interface: DeletionAware
Returns a List of additional Resource instances. These resources do not require user confirmation before deletion.

Specified by:
getResources in interface DeletionAware

getOptionalResources

public List<Resource<?>> getOptionalResources()
Description copied from interface: DeletionAware
Returns a List of additional Resource instances. These resources require user confirmation before deletion.

Specified by:
getOptionalResources in interface DeletionAware

Forge - Parent 1.1.2-SNAPSHOT

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