org.apache.ws.jaxme.js

Class Util


public class Util
extends java.lang.Object

Various static utility methods.
Author:
Jochen Wiedmann

Method Summary

static String
asJavaIdentifier(String pIdentifier)
Takes as input an arbitrary String and maps it to a String, which is a valid Java identifier.
static void
checkJavaIdentifier(String pName)
Returns whether the given name is a valid Java identifier.
static JavaSource
newJavaSource(JavaSourceFactory pFactory, Class pClass)
Converts the given class into an instance of JavaSource.

Method Details

asJavaIdentifier

public static String asJavaIdentifier(String pIdentifier)
Takes as input an arbitrary String and maps it to a String, which is a valid Java identifier. Mapping works as follows:
  1. For the first character, invokes Character.isJavaIdentifierStart(char). If that method returns false, replaces the character with an underscore ('_').
  2. For any following character, invokes Character.isJavaIdentifierPart(char). If that method returns false, replaces the character with an underscore ('_').
Parameters:
pIdentifier - The identifier being mapped

checkJavaIdentifier

public static void checkJavaIdentifier(String pName)
Returns whether the given name is a valid Java identifier. Works by using Character.isJavaIdentifierStart(char) and Character.isJavaIdentifierPart(char).

newJavaSource

public static JavaSource newJavaSource(JavaSourceFactory pFactory,
                                       Class pClass)
Converts the given class into an instance of JavaSource.