org.openide.filesystems 7.21.1 1

org.openide.filesystems.annotations
Class LayerBuilder

java.lang.Object
  extended by org.openide.filesystems.annotations.LayerBuilder

public final class LayerBuilder
extends Object

Convenience class for generating fragments of an XML layer.

Since:
org.openide.filesystems 7.15
See Also:
LayerGeneratingProcessor.layer(javax.lang.model.element.Element...)

Nested Class Summary
 class LayerBuilder.File
          Builder for creating a single file entry.
 
Method Summary
 LayerBuilder.File file(String path)
          Adds a file to the layer.
 LayerBuilder.File instanceFile(String path, String name, Class type)
          Generates an instance file whose InstanceCookie would load the associated class or method.
 LayerBuilder.File shadowFile(String target, String folder, String name)
          Convenience method to create a shadow file (like a symbolic link).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

file

public LayerBuilder.File file(String path)
Adds a file to the layer. You need to LayerBuilder.File.write() it in order to finalize the effect.

Parameters:
path - the full path to the desired file in resource format, e.g. "Menu/File/exit.instance"
Returns:
a file builder

instanceFile

public LayerBuilder.File instanceFile(String path,
                                      String name,
                                      Class type)
                               throws IllegalArgumentException,
                                      LayerGenerationException
Generates an instance file whose InstanceCookie would load the associated class or method. Useful for LayerGeneratingProcessors which define layer fragments which instantiate Java objects from the annotated code.

While you can pick a specific instance file name, if possible you should pass null for name as using the generated name will help avoid accidental name collisions between annotations.

Parameters:
path - path to folder of instance file, e.g. "Menu/File"
name - instance file basename, e.g. "my-menu-Item", or null to pick a name according to the element
type - a type to which the instance ought to be assignable, or null to skip this check
Returns:
an instance file (call LayerBuilder.File.write() to finalize)
Throws:
IllegalArgumentException - if the builder is not associated with exactly one class or method
LayerGenerationException - if the associated element would not be loadable as an instance of the specified type

shadowFile

public LayerBuilder.File shadowFile(String target,
                                    String folder,
                                    String name)
Convenience method to create a shadow file (like a symbolic link).

While you can pick a specific shadow file name, if possible you should pass null for name as using the generated name will help avoid accidental name collisions between annotations.

Parameters:
target - the complete path to the original file (use LayerBuilder.File.getPath() if you just made it)
folder - the folder path in which to create the shadow, e.g. "Menu/File"
name - the basename of the shadow file sans extension, e.g. "my-Action", or null to pick a default
Returns:
a shadow file (call LayerBuilder.File.write() to finalize)

org.openide.filesystems 7.21.1 1

Built on August 26 2009.  |  Portions Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.