org.jvnet.ws.wadl2java
Class GeneratorUtil

java.lang.Object
  extended by org.jvnet.ws.wadl2java.GeneratorUtil

public class GeneratorUtil
extends Object

Utility functions for code generators.

Author:
mh124079

Constructor Summary
GeneratorUtil()
           
 
Method Summary
static com.sun.codemodel.JClass getJavaType(Param param, com.sun.codemodel.JCodeModel model, com.sun.codemodel.JDefinedClass parentClass, JavaDocUtil javaDoc)
          Maps WADL param types to their respective Java type.
static String makeClassName(String input)
          Utility function for generating a suitable Java class name from an arbitrary string.
static String makeConstantName(String input)
          Make a Java constant name for the supplied WADL parameter.
static String makeParamName(String input)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneratorUtil

public GeneratorUtil()
Method Detail

makeConstantName

public static String makeConstantName(String input)
Make a Java constant name for the supplied WADL parameter. Capitalizes all chars and replaces illegal chars with '_'.

Parameters:
input - the WADL parameter.
Returns:
a constant name.

makeClassName

public static String makeClassName(String input)
Utility function for generating a suitable Java class name from an arbitrary string. Replaces any characters not allowed in an class name with '_'.

Parameters:
input - the string.
Returns:
a string suitable for use as a Java class name.

makeParamName

public static String makeParamName(String input)

getJavaType

public static com.sun.codemodel.JClass getJavaType(Param param,
                                                   com.sun.codemodel.JCodeModel model,
                                                   com.sun.codemodel.JDefinedClass parentClass,
                                                   JavaDocUtil javaDoc)
Maps WADL param types to their respective Java type. For params with child option elements a Java enum is generated, otherwise an existing Java class is used.

Parameters:
param - the WADL parameter.
model - the JAXB codeModel instance to use if code generation is required.
parentClass - the class in which any generated enums will be placed.
javaDoc - a JavaDocUtil instance that will be used for generating JavaDoc comments on any generated enum.
Returns:
the class of the corresponding Java type.


Copyright © 2012. All Rights Reserved.