Java Doc for LocalUtil.java in  » Ajax » dwr » org » directwebremoting » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » dwr » org.directwebremoting.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.directwebremoting.util.LocalUtil

LocalUtil
final public class LocalUtil (Code)
Various utilities, stuff that we're still surprised isn't in the JDK, and stuff that perhaps is borderline JDK material, but isn't really pure DWR either.
author:
   Joe Walker [joe at getahead dot ltd dot uk]


Field Summary
final public static  intINBOUND_INDEX_TYPE
    
final public static  intINBOUND_INDEX_VALUE
    


Method Summary
public static  voidaddNoCacheHeaders(HttpServletResponse resp)
     Add headers to prevent browsers and proxies from caching this reply.
public static  ClassclassForName(String className)
     Utility to essentially do Class forName and allow configurable Classloaders.
public static  Class<? extends T>classForName(String debugContext, String className, Class<T> impl)
     Utility to essentially do Class forName with the assumption that the environment expects failures for missing jar files and can carry on if this process fails.
public static  TclassNewInstance(String name, String className, Class<T> impl)
     Utility to essentially do Class forName and newInstance with the assumption that the environment expects failures for missing jar files and can carry on if this process fails.
public static  voidclose(Closeable in)
     InputStream closer that can cope if the input stream is null.
public static  Stringdecode(String value)
     URL decode a value.
public static  Field[]getAllFields(Class clazz)
     Return a list of all fields (whatever access status, and on whatever superclass they were defined) that can be found on this class.
public static  List<Class<?>>getAllSuperclasses(Class clazz)
     Return a List of super-classes for the given class.
public static  ClassgetNonPrimitiveType(Class type)
    
public static  Objectinvoke(Object object, Method method, Object[] params)
    
public static  booleanisEquivalent(Class c1, Class c2)
     True if c1 is java.lang.Boolean and c2 is boolean, etc.
public static  booleanisJavaIdentifier(String test)
     Determines if the specified string is permissible as a Java identifier. Returns true if the string is non-null, non-zero length with a Java identifier start as the first character and Java identifier parts in all remaining characters.
Parameters:
  test - the string to be tested.
public static  booleanisLetterOrDigitOrUnderline(String test)
    
public static  booleanisServletClass(Class paramType)
    
public static  booleanisSimpleName(String name)
     Is this object property one that we can use in a JSON style or do we need to get fancy.
public static  booleanisTypeSimplyConvertable(Class paramType)
    
public static  Stringjoin(Object[] array, String separator)
     Create a string by joining the array elements together with the separator in-between each element.
public static  voidsetParams(Object object, Map<String, ?> params, List<String> ignore)
    
public static  voidsetProperty(Object object, String key, Object value)
    
public static  TsimpleConvert(String value, Class<T> paramType)
     A very simple conversion function for all the IoC style setup and reflection that we are doing.
Parameters:
  value - The value to convert
Parameters:
  paramType - The type to convert to.

Field Detail
INBOUND_INDEX_TYPE
final public static int INBOUND_INDEX_TYPE(Code)
splitInbound() returns the type info in this parameter



INBOUND_INDEX_VALUE
final public static int INBOUND_INDEX_VALUE(Code)
splitInbound() returns the value info in this parameter





Method Detail
addNoCacheHeaders
public static void addNoCacheHeaders(HttpServletResponse resp)(Code)
Add headers to prevent browsers and proxies from caching this reply.
Parameters:
  resp - The response to add headers to



classForName
public static Class classForName(String className) throws ClassNotFoundException(Code)
Utility to essentially do Class forName and allow configurable Classloaders.

The initial implementation makes use of the context classloader for the current thread.
Parameters:
  className - The class to create The class if it is safe or null otherwise.
throws:
  ClassNotFoundException - If className is not valid




classForName
public static Class<? extends T> classForName(String debugContext, String className, Class<T> impl)(Code)
Utility to essentially do Class forName with the assumption that the environment expects failures for missing jar files and can carry on if this process fails. <
Parameters:
  T - > The base type that we want a class to implement
Parameters:
  debugContext - The name for debugging purposes
Parameters:
  className - The class to create
Parameters:
  impl - The implementation class - what should className do? The class if it is safe or null otherwise.



classNewInstance
public static T classNewInstance(String name, String className, Class<T> impl)(Code)
Utility to essentially do Class forName and newInstance with the assumption that the environment expects failures for missing jar files and can carry on if this process fails. <
Parameters:
  T - > The base type that we want a class to implement
Parameters:
  name - The name for debugging purposes
Parameters:
  className - The class to create
Parameters:
  impl - The implementation class - what should className do? The new instance if it is safe or null otherwise.



close
public static void close(Closeable in)(Code)
InputStream closer that can cope if the input stream is null. If anything goes wrong, the errors are logged and ignored.
Parameters:
  in - The resource to close



decode
public static String decode(String value)(Code)
URL decode a value. URLDecoder.decode(StringString) throws an UnsupportedEncodingException , which is silly given that the most common use case will be to pass in "UTF-8"
Parameters:
  value - The string to decode The decoded string



getAllFields
public static Field[] getAllFields(Class clazz)(Code)
Return a list of all fields (whatever access status, and on whatever superclass they were defined) that can be found on this class.

This is like a union of Class.getDeclaredFields which ignores and super-classes, and Class.getFields which ignored non-public fields
Parameters:
  clazz - The class to introspect The complete list of fields




getAllSuperclasses
public static List<Class<?>> getAllSuperclasses(Class clazz)(Code)
Return a List of super-classes for the given class.
Parameters:
  clazz - the class to look up the List of super-classes in order going up from this one



getNonPrimitiveType
public static Class getNonPrimitiveType(Class type)(Code)

Parameters:
  type - The class to de-primitivize The non-primitive version of the class



invoke
public static Object invoke(Object object, Method method, Object[] params) throws IllegalStateException(Code)
Calling methods using reflection is useful for graceful fallback - this is a helper method to make this easy
Parameters:
  object - The object to use as 'this'
Parameters:
  method - The method to call, can be null in which case null is returned
Parameters:
  params - The parameters to pass to the reflection call The results of calling method.invoke() or null
throws:
  IllegalStateException - If anything goes wrong



isEquivalent
public static boolean isEquivalent(Class c1, Class c2)(Code)
True if c1 is java.lang.Boolean and c2 is boolean, etc.
Parameters:
  c1 - the first class to test
Parameters:
  c2 - the second class to test true if the classes are equivalent



isJavaIdentifier
public static boolean isJavaIdentifier(String test)(Code)
Determines if the specified string is permissible as a Java identifier. Returns true if the string is non-null, non-zero length with a Java identifier start as the first character and Java identifier parts in all remaining characters.
Parameters:
  test - the string to be tested. true if the string is a Java identifier, false otherwise.
See Also:   java.lang.Character.isJavaIdentifierPart(char)
See Also:   java.lang.Character.isJavaIdentifierStart(char)



isLetterOrDigitOrUnderline
public static boolean isLetterOrDigitOrUnderline(String test)(Code)
Determines if the specified string contains only Unicode letters or digits as defined by Character.isLetterOrDigit(char)
Parameters:
  test - The string to test true if the string is non-null, non-empty and contains onlycharacters that are unicode letters or digits
See Also:   Character.isLetterOrDigit(char)



isServletClass
public static boolean isServletClass(Class paramType)(Code)
Is this class one that we auto fill, so the user can ignore?
Parameters:
  paramType - The type to test true if the type is a Servlet type



isSimpleName
public static boolean isSimpleName(String name)(Code)
Is this object property one that we can use in a JSON style or do we need to get fancy. i.e does it contain only letters and numbers with an initial letter.
Parameters:
  name - The name to test for JSON compatibility true if the name is simple



isTypeSimplyConvertable
public static boolean isTypeSimplyConvertable(Class paramType)(Code)
Can the type be used in a call to LocalUtil.simpleConvert(String,Class) ?
Parameters:
  paramType - The type to test true if the type is acceptable to simpleConvert()



join
public static String join(Object[] array, String separator)(Code)
Create a string by joining the array elements together with the separator in-between each element. A null (in the array or as a separator) is treated as an empty string.
Parameters:
  array - The array of elements to join
Parameters:
  separator - The string sequence to place between array elements A string containing the joined elements



setParams
public static void setParams(Object object, Map<String, ?> params, List<String> ignore)(Code)
Set use reflection to set the setters on the object called by the keys in the params map with the corresponding values
Parameters:
  object - The object to setup
Parameters:
  params - The settings to use
Parameters:
  ignore - List of keys to not warn about if they are not propertiesNote only the warning is skipped, we still try the setter



setProperty
public static void setProperty(Object object, String key, Object value) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException(Code)
Set a property on an object using reflection
Parameters:
  object - The object to call the setter on
Parameters:
  key - The name of the property to set.
Parameters:
  value - The new value to use for the property
throws:
  NoSuchMethodException - Passed on from reflection code
throws:
  SecurityException - Passed on from reflection code
throws:
  IllegalAccessException - Passed on from reflection code
throws:
  IllegalArgumentException - Passed on from reflection code
throws:
  InvocationTargetException - Passed on from reflection code



simpleConvert
public static T simpleConvert(String value, Class<T> paramType)(Code)
A very simple conversion function for all the IoC style setup and reflection that we are doing.
Parameters:
  value - The value to convert
Parameters:
  paramType - The type to convert to. Currently any primitive types andString are supported. The converted object.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.