public class FigureProvider extends Object implements NodeProvider
FigureProvider can be used
to quickly add a lot of Figures
to a scene, from [figure].json files.
Exceptions thrown from the ResourceLoader will
get catched and rethrown as RuntimeException.| Modifier and Type | Field and Description |
|---|---|
protected String |
name |
protected List<String> |
names |
| Constructor and Description |
|---|
FigureProvider(String name,
List<String> names)
Construct a new FigureProvider...
|
FigureProvider(String name,
String... names)
Construct a new FigureProvider...
|
| Modifier and Type | Method and Description |
|---|---|
Node |
get()
Returns the following Node Structure:
FigureProvider f = new FigureProvider("name", "floor", "another");
f.get();
| Node(name)
|
| -> | Node(floor)
| | -> Figure(floor)
|
| -> | Node(another)
| | -> Figure(another)
|
Node |
inject(Node target)
The figure names were given in the constructor.
|
public FigureProvider(String name, List<String> names)
name - Name of the root Node returnednames - Names of json figure declarationspublic FigureProvider(String name, String... names)
inject(Node) exclusively.name - Name of the root Node returnednames - Names of json figure declarationspublic Node get()
FigureProvider f = new FigureProvider("name", "floor", "another");
f.get();
| Node(name)
|
| -> | Node(floor)
| | -> Figure(floor)
|
| -> | Node(another)
| | -> Figure(another)
get in interface NodeProviderRuntimeException - when an exception is thrown from the ResourceLoaderpublic Node inject(Node target)
target.add(ResourceLoader.getFigure(name).boxed());
This method just returns the given target, for easier method chaining.target - all loaded boxed figures will be added to the target's childrenRuntimeException - when an exception is thrown from the ResourceLoaderCopyright © 2015. All rights reserved.