站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 jaxrpc API Documentation 英文版文档

JavaUtils (JAXRPC API) - JBoss 3.2.7 jaxrpc API Documentation 英文版文档


org.apache.axis.utils
Class JavaUtils

java.lang.Object
  extended byorg.apache.axis.utils.JavaUtils

public class JavaUtils
extends Object

Utility class to deal with Java language related issues, such as type conversions.

Author:
Glen Daniels (gdaniels@macromedia.com)

Nested Class Summary
static interface JavaUtils.ConvertCache
          It the argument to the convert(...) method implements the ConvertCache interface, the convert(...) method will use the set/get methods to store and retrieve converted values.
static class JavaUtils.HolderException
           
 
Field Summary
static char CR
           
static String LS
          The prefered line separator
static char NL
           
 
Constructor Summary
JavaUtils()
           
 
Method Summary
static Object convert(Object arg, Class destClass)
          Utility function to convert an Object to some desired Class.
static Class getHolderType(Class type)
          Determines if the Holder Class for a given held class.
static Object getHolderValue(Object holder)
          Gets the Holder value.
static Class getHolderValueType(Class type)
          Determines if the Class is a Holder class.
static Image getImageFromStream(InputStream is)
           
static String getLoadableClassName(String text)
          Converts text of the form Foo[] to the proper class name for loading [LFoo
static Class getPrimitiveClass(Class wrapper)
           
static Class getPrimitiveClass(String javaType)
           
static String getTextClassName(String text)
          Converts text of the form [LFoo to the Foo[]
static Class getUnsignedClass(Class primitive)
           
static String getWrapper(String primitive)
           
static Class getWrapperClass(Class primitive)
           
static boolean isArrayClass(Class cls)
          Determine if the class is an array TDI 20-June-2004
static boolean isAttachmentSupported()
          Determine whether attachments are supported by checking if the following classes are available: javax.activation.DataHandler, javax.mail.internet.MimeMultipart.
static boolean isBeanCompatible(Class javaType)
          isBeanCompatible
static boolean isConvertable(Object obj, Class dest)
           
static boolean isConvertable(Object obj, Class dest, boolean isEncoded)
           
static boolean isEnumClass(Class cls)
          Determine if the class is a JAX-RPC enum class.
static boolean isFalse(Object value)
           
static boolean isFalse(Object value, boolean defaultVal)
          Tests the Object 'value': if its null, return default.
static boolean isFalse(String value)
          Tests the String 'value': return 'true' if its 'false', '0', or 'no' - else 'false'

Follow in 'C' tradition of boolean values: false is specific (0), everything else is true;

static boolean isFalseExplicitly(Object value)
           
static boolean isFalseExplicitly(Object value, boolean defaultVal)
          Tests the Object 'value': if its null, return default.
static boolean isFalseExplicitly(String value)
          Tests the String 'value': return 'true' if its null, 'false', '0', or 'no' - else 'false'
static boolean isJavaId(String id)
          isJavaId Returns true if the name is a valid java identifier.
static boolean isJavaKeyword(String keyword)
          checks if the input string is a valid java keyword.
static boolean isTrue(Object value)
           
static boolean isTrue(Object value, boolean defaultVal)
          Tests the Object 'value': if its null, return default.
static boolean isTrue(String value)
          Tests the String 'value': return 'false' if its 'false', '0', or 'no' - else 'true'

Follow in 'C' tradition of boolean values: false is specific (0), everything else is true;

static boolean isTrueExplicitly(Object value)
           
static boolean isTrueExplicitly(Object value, boolean defaultVal)
          Tests the Object 'value': if its null, return default.
static boolean isTrueExplicitly(String value)
          Tests the String 'value': return 'true' if its 'true', '1', or 'yes' - else 'false'
static String makeNonJavaKeyword(String keyword)
          Turn a java keyword string into a non-Java keyword string.
static String mimeToJava(String mime)
          Given the MIME type string, return the Java mapping.
static String replace(String name, String oldT, String newT)
          replace: Like String.replace except that the old new items are strings.
static void setHolderValue(Object holder, Object value)
          Sets the Holder value.
static String stackToString(Throwable e)
           
static String xmlNameToJava(String name)
          Map an XML name to a Java identifier per the mapping rules of JSR 101 (in version 1.0 this is "Chapter 20: Appendix: Mapping of XML Names"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NL

public static final char NL
See Also:
Constant Field Values

CR

public static final char CR
See Also:
Constant Field Values

LS

public static final String LS
The prefered line separator

Constructor Detail

JavaUtils

public JavaUtils()
Method Detail

getWrapperClass

public static Class getWrapperClass(Class primitive)

getWrapper

public static String getWrapper(String primitive)

getUnsignedClass

public static Class getUnsignedClass(Class primitive)

getPrimitiveClass

public static Class getPrimitiveClass(Class wrapper)

getPrimitiveClass

public static Class getPrimitiveClass(String javaType)

convert

public static Object convert(Object arg,
                             Class destClass)
Utility function to convert an Object to some desired Class.

Right now this works for: arrays <-> Lists, Holders <-> held values

Parameters:
arg - the array to convert
destClass - the actual class we want

isConvertable

public static boolean isConvertable(Object obj,
                                    Class dest)

isConvertable

public static boolean isConvertable(Object obj,
                                    Class dest,
                                    boolean isEncoded)

isBeanCompatible

public static boolean isBeanCompatible(Class javaType)
isBeanCompatible

Parameters:
javaType - Class

getImageFromStream

public static Image getImageFromStream(InputStream is)

isJavaId

public static boolean isJavaId(String id)
isJavaId Returns true if the name is a valid java identifier.

Parameters:
id - to check
Returns:
boolean true/false

isJavaKeyword

public static boolean isJavaKeyword(String keyword)
checks if the input string is a valid java keyword.

Returns:
boolean true/false

makeNonJavaKeyword

public static String makeNonJavaKeyword(String keyword)
Turn a java keyword string into a non-Java keyword string. (Right now this simply means appending an underscore.)


getLoadableClassName

public static String getLoadableClassName(String text)
Converts text of the form Foo[] to the proper class name for loading [LFoo


getTextClassName

public static String getTextClassName(String text)
Converts text of the form [LFoo to the Foo[]


xmlNameToJava

public static String xmlNameToJava(String name)
Map an XML name to a Java identifier per the mapping rules of JSR 101 (in version 1.0 this is "Chapter 20: Appendix: Mapping of XML Names"

Parameters:
name - is the xml name
Returns:
the java name per JSR 101 specification

replace

public static final String replace(String name,
                                   String oldT,
                                   String newT)
replace: Like String.replace except that the old new items are strings.

Parameters:
name - string
oldT - old text to replace
newT - new text to use
Returns:
replacement string

getHolderType

public static Class getHolderType(Class type)
Determines if the Holder Class for a given held class.

Parameters:
type - the held class
Returns:
holder class or null

getHolderValueType

public static Class getHolderValueType(Class type)
Determines if the Class is a Holder class. If so returns Class of held type else returns null

Parameters:
type - the suspected Holder Class
Returns:
class of held type or null

getHolderValue

public static Object getHolderValue(Object holder)
                             throws JavaUtils.HolderException
Gets the Holder value.

Parameters:
holder - Holder object
Returns:
value object
Throws:
JavaUtils.HolderException

setHolderValue

public static void setHolderValue(Object holder,
                                  Object value)
                           throws JavaUtils.HolderException
Sets the Holder value.

Parameters:
holder - Holder object
value - is the object value
Throws:
JavaUtils.HolderException

isEnumClass

public static boolean isEnumClass(Class cls)
Determine if the class is a JAX-RPC enum class. An enumeration class is recognized by a getValue() method, a toString() method, a fromString(String) method a fromValue(type) method and the lack of a setValue(type) method


isArrayClass

public static boolean isArrayClass(Class cls)
Determine if the class is an array TDI 20-June-2004


stackToString

public static String stackToString(Throwable e)

isTrue

public static final boolean isTrue(String value)
Tests the String 'value': return 'false' if its 'false', '0', or 'no' - else 'true'

Follow in 'C' tradition of boolean values: false is specific (0), everything else is true;


isTrueExplicitly

public static final boolean isTrueExplicitly(String value)
Tests the String 'value': return 'true' if its 'true', '1', or 'yes' - else 'false'


isTrueExplicitly

public static final boolean isTrueExplicitly(Object value,
                                             boolean defaultVal)
Tests the Object 'value': if its null, return default. if its a Boolean, return booleanValue() if its an Integer, return 'false' if its '0' else 'true' if its a String, return isTrueExplicitly((String)value). All other types return 'true'


isTrueExplicitly

public static final boolean isTrueExplicitly(Object value)

isTrue

public static final boolean isTrue(Object value,
                                   boolean defaultVal)
Tests the Object 'value': if its null, return default. if its a Boolean, return booleanValue() if its an Integer, return 'false' if its '0' else 'true' if its a String, return 'false' if its 'false', 'no', or '0' - else 'true' All other types return 'true'


isTrue

public static final boolean isTrue(Object value)

isFalse

public static final boolean isFalse(String value)
Tests the String 'value': return 'true' if its 'false', '0', or 'no' - else 'false'

Follow in 'C' tradition of boolean values: false is specific (0), everything else is true;


isFalseExplicitly

public static final boolean isFalseExplicitly(String value)
Tests the String 'value': return 'true' if its null, 'false', '0', or 'no' - else 'false'


isFalseExplicitly

public static final boolean isFalseExplicitly(Object value,
                                              boolean defaultVal)
Tests the Object 'value': if its null, return default. if its a Boolean, return !booleanValue() if its an Integer, return 'true' if its '0' else 'false' if its a String, return isFalseExplicitly((String)value). All other types return 'false'


isFalseExplicitly

public static final boolean isFalseExplicitly(Object value)

isFalse

public static final boolean isFalse(Object value,
                                    boolean defaultVal)
Tests the Object 'value': if its null, return default. if its a Boolean, return booleanValue() if its an Integer, return 'false' if its '0' else 'true' if its a String, return 'false' if its 'false', 'no', or '0' - else 'true' All other types return 'true'


isFalse

public static final boolean isFalse(Object value)

mimeToJava

public static String mimeToJava(String mime)
Given the MIME type string, return the Java mapping.


isAttachmentSupported

public static boolean isAttachmentSupported()
Determine whether attachments are supported by checking if the following classes are available: javax.activation.DataHandler, javax.mail.internet.MimeMultipart.



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.