Package org.infinispan.cli.resources
Class AbstractResource
- java.lang.Object
-
- org.infinispan.cli.resources.AbstractResource
-
- All Implemented Interfaces:
Resource
- Direct Known Subclasses:
CacheKeyResource,CacheResource,CachesResource,ClusterResource,ConfigurationsResource,ContainerResource,ContainersResource,CounterResource,CountersResource,NodeResource,RootResource,SchemasResource,ServerResource,TaskResource,TasksResource
public abstract class AbstractResource extends Object implements Resource
- Since:
- 10.0
- Author:
- Tristan Tarrant <tristan@infinispan.org>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.cli.resources.Resource
Resource.ListFormat
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractResource(Resource parent, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringdescribe()Returns a textual representation of this resource<T extends Resource>
TfindAncestor(Class<T> resourceClass)Finds the resource of the specified type within the ancestors of this resourceResourcegetChild(String name)Returns a resource representing the named childResourcegetChild(String... name)Returns a resource representing the named childIterable<String>getChildrenNames()Returns an iterable over the children of this resourceStringgetName()Returns the name of this resourceResourcegetParent()Returns the parent resource of this resource.ResourcegetResource(String path)booleanisLeaf()Returns whether this resource is a leaf resource (i.e.<T extends Resource>
Optional<T>optionalFindAncestor(Class<T> resourceClass)Finds the resource of the specified type within the ancestors of this resourcevoidprintChildren(Resource.ListFormat format, int limit, PrettyPrinter.PrettyPrintMode prettyPrintMode, org.aesh.command.shell.Shell shell)
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:ResourceReturns the name of this resource
-
getParent
public Resource getParent()
Description copied from interface:ResourceReturns the parent resource of this resource. This is null if the resource represents the root.
-
getChildrenNames
public Iterable<String> getChildrenNames() throws IOException
Description copied from interface:ResourceReturns an iterable over the children of this resource- Specified by:
getChildrenNamesin interfaceResource- Throws:
IOException
-
printChildren
public void printChildren(Resource.ListFormat format, int limit, PrettyPrinter.PrettyPrintMode prettyPrintMode, org.aesh.command.shell.Shell shell) throws IOException
- Specified by:
printChildrenin interfaceResource- Throws:
IOException
-
getChild
public Resource getChild(String name) throws IOException
Description copied from interface:ResourceReturns a resource representing the named child- Specified by:
getChildin interfaceResource- Throws:
IOException
-
getChild
public Resource getChild(String... name) throws IOException
Description copied from interface:ResourceReturns a resource representing the named child- Specified by:
getChildin interfaceResource- Throws:
IOException
-
findAncestor
public <T extends Resource> T findAncestor(Class<T> resourceClass)
Description copied from interface:ResourceFinds the resource of the specified type within the ancestors of this resource- Specified by:
findAncestorin interfaceResource
-
optionalFindAncestor
public <T extends Resource> Optional<T> optionalFindAncestor(Class<T> resourceClass)
Description copied from interface:ResourceFinds the resource of the specified type within the ancestors of this resource- Specified by:
optionalFindAncestorin interfaceResource
-
isLeaf
public boolean isLeaf()
Description copied from interface:ResourceReturns whether this resource is a leaf resource (i.e. it has no children, or the children are not navigable)
-
describe
public String describe() throws IOException
Description copied from interface:ResourceReturns a textual representation of this resource- Specified by:
describein interfaceResource- Throws:
IOException
-
getResource
public Resource getResource(String path) throws IOException
- Specified by:
getResourcein interfaceResource- Throws:
IOException
-
-