org.codehaus.enunciate.template.freemarker
Class ClientPackageForMethod

java.lang.Object
  extended by org.codehaus.enunciate.template.freemarker.ClientPackageForMethod
All Implemented Interfaces:
freemarker.template.TemplateMethodModel, freemarker.template.TemplateMethodModelEx, freemarker.template.TemplateModel
Direct Known Subclasses:
ClassnameForMethod

public class ClientPackageForMethod
extends java.lang.Object
implements freemarker.template.TemplateMethodModelEx

Gets the qualified package name for a package or type.

Author:
Ryan Heaton

Field Summary
 
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
 
Constructor Summary
ClientPackageForMethod(java.util.Map<java.lang.String,java.lang.String> conversions)
           
 
Method Summary
 java.lang.String convert(com.sun.mirror.declaration.PackageDeclaration packageDeclaration)
          Converts the package declaration to its client-side package value.
 java.lang.String convert(java.lang.String fqn)
          Converts the possible package to the specified client-side package, if any conversions are specified.
 java.lang.String convert(com.sun.mirror.declaration.TypeDeclaration declaration)
          Returns the client-side package value for the given type declaration.
 java.lang.String convert(com.sun.mirror.type.TypeMirror typeMirror)
          Returns the client-side package value for the given type.
 java.lang.String convertUnwrappedObject(java.lang.Object unwrapped)
          Converts an unwrapped object.
 java.lang.Object exec(java.util.List list)
          Gets the client-side package for the type, type declaration, package, or their string values.
 boolean isUseClientNameConversions()
          Whether to use the client name conversions.
 void setUseClientNameConversions(boolean useClientNameConversions)
          Whether to use the client name conversions.
protected  java.lang.Object unwrap(java.lang.Object first)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientPackageForMethod

public ClientPackageForMethod(java.util.Map<java.lang.String,java.lang.String> conversions)
Parameters:
conversions - The conversions.
Method Detail

exec

public java.lang.Object exec(java.util.List list)
                      throws freemarker.template.TemplateModelException
Gets the client-side package for the type, type declaration, package, or their string values.

Specified by:
exec in interface freemarker.template.TemplateMethodModel
Specified by:
exec in interface freemarker.template.TemplateMethodModelEx
Parameters:
list - The arguments.
Returns:
The string value of the client-side package.
Throws:
freemarker.template.TemplateModelException

unwrap

protected java.lang.Object unwrap(java.lang.Object first)
                           throws freemarker.template.TemplateModelException
Throws:
freemarker.template.TemplateModelException

convertUnwrappedObject

public java.lang.String convertUnwrappedObject(java.lang.Object unwrapped)
                                        throws freemarker.template.TemplateModelException
Converts an unwrapped object.

Parameters:
unwrapped - The unwrapped object to convert.
Returns:
The conversion.
Throws:
freemarker.template.TemplateModelException

convert

public java.lang.String convert(com.sun.mirror.type.TypeMirror typeMirror)
                         throws freemarker.template.TemplateModelException
Returns the client-side package value for the given type.

Parameters:
typeMirror - The type.
Returns:
The client-side package value for the type.
Throws:
freemarker.template.TemplateModelException - If the type mirror cannot be converted for some reason.

convert

public java.lang.String convert(com.sun.mirror.declaration.TypeDeclaration declaration)
                         throws freemarker.template.TemplateModelException
Returns the client-side package value for the given type declaration.

Parameters:
declaration - The declaration.
Returns:
The client-side package value for the declaration.
Throws:
freemarker.template.TemplateModelException

convert

public java.lang.String convert(com.sun.mirror.declaration.PackageDeclaration packageDeclaration)
Converts the package declaration to its client-side package value.

Parameters:
packageDeclaration - The package declaration.
Returns:
The package declaration.

convert

public java.lang.String convert(java.lang.String fqn)
Converts the possible package to the specified client-side package, if any conversions are specified.

Parameters:
fqn - The package to convert.
Returns:
The converted package, or the original if no conversions were specified for this value.

isUseClientNameConversions

public boolean isUseClientNameConversions()
Whether to use the client name conversions.

Returns:
Whether to use the client name conversions.

setUseClientNameConversions

public void setUseClientNameConversions(boolean useClientNameConversions)
Whether to use the client name conversions.

Parameters:
useClientNameConversions - Whether to use the client name conversions.