Java Doc for JavaUtil.java in  » IDE-Netbeans » schema2beans » org » netbeans » modules » schema2beansdev » gen » 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 » IDE Netbeans » schema2beans » org.netbeans.modules.schema2beansdev.gen 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.netbeans.modules.schema2beansdev.gen.JavaUtil

JavaUtil
public class JavaUtil (Code)
Various utility methods dealing with Java

Inner Class :public static class N2AFilter extends FilterWriter
Inner Class :public static class InputMonitor implements Runnable

Field Summary
final public static  intBUFFER_SIZE
    


Method Summary
public static  StringbaseClassOfArray(String className)
    
public static  StringbaseName(String fullClassName)
     This will return a name from @param fullClassName where everything upto and including the last '.' is removed.
public static  booleancanProduceNoXMLMetaChars(String className)
    
public static  booleancheckValueToType(String type, String value)
     checkValueToType will make sure that a given value is acceptable for a given type.
public static  StringcompareTo(String value1, String type1, String value2)
     Convert @param value2 (a literal) to @param type1 and then compare that to @param value1.
public static  StringcompareToText(String value1, String type1, String value2Text)
     Just like compareTo, but the second value (@param value2Text) is unquoted text.
public static  intcopyStream(Writer out, Reader in)
     copyStream is not really a Java Utility method, but it's needed by one of them, and so is here.
public static  intcopyStream(OutputStream out, InputStream in)
     copyStream is not really a Java Utility method, but it's needed by one of them, and so is here.
public static  StringescapeCharForInstance(char c, char illegalChar)
     A helper method for instanceFrom.
public static  ListexceptionsFromParsingText(String type)
     What exceptions might we encounter from doing the result of genParseText.
public static  ListexceptionsFromParsingText(String type, boolean fromParsing)
    
public static  StringexprToInt(String type, String expr)
     Given a scalar type, figure out how to make it into an int (ie, hash code).
public static  StringfromObject(String type, String expr)
    
public static  StringfromObjectType(String classType)
     Take a Java boxed object (like Integer) and return it's primitive type.
public static  StringgenEquals(String type, String attr1, String attr2)
    
public static  StringgenEquals(String type, String attr1, String attr2, boolean attr1CanBeNull)
    
public static  StringgenNewDefault(String type)
    
public static  StringgenParseText(String type, String expr, boolean j2me)
    
public static  StringgenParseText(String type, String expr)
     Take a particular @param type (eg: "java.lang.Integer") and return a String that will parse the @param expr and make it into that type.
public static  StringgenParseText(String type, String expr, String var)
     Take a particular @param type (eg: "java.lang.Integer") and return a String that will parse the @param expr, making it into that type, and storing the value into @param var.
public static  StringgenParseText(String type, String expr, String var, boolean j2me)
    
public static  StringgenParseTextME(String type, String name)
     Take a particular @param type (eg: "java.lang.Integer") and return a String that will parse the @param expr and make it into that type.
public static  StringgetCanonicalClassName(Class cls)
    
public static  intgetOptimialHashMapSize(Object[] keys)
    
public static  intgetOptimialHashMapSize(Object[] keys, int maxSize)
     Using reflection figure out the optimal initial capacity for a HashMap given some keys.
public static  ClassgetPrimitive(String className)
    
public static  StringinstanceFrom(String type, String value)
     Take a String (@param value) and generate Java code to coerce it.
public static  booleanisCloneable(String className)
     Looks for the class and sees if it's cloneable.
public static  booleanisImmutable(String className)
     Is @param className immutable? An immutable object can hold state, but after it's been constructed that state cannot change.
public static  booleanisInstantiable(String className)
     Is the class not an interface and not abstract; i.e., it's possible to call a constructor on this class.
public static  booleanisPrimitiveType(String className)
    
public static  voidnative2ascii(Writer out, Reader in)
    
public static  StringnullValueForType(String type)
    
public static  booleanreservedWord(String name)
    
public static  StringtoObject(String expr, String classType)
     Convert primitives into Objects and leave objects as is.
public static  StringtoObject(String expr, String classType, boolean j2me)
    
public static  StringtoObjectType(String classType)
     Take a Java primitive and return it's object type.
public static  StringtypeToString(String type, String expr)
     Convert expr into a String.
public static  Stringuencode(char c)
     Take a character and return the \ u (Unicode) representation of it.

Field Detail
BUFFER_SIZE
final public static int BUFFER_SIZE(Code)





Method Detail
baseClassOfArray
public static String baseClassOfArray(String className)(Code)



baseName
public static String baseName(String fullClassName)(Code)
This will return a name from @param fullClassName where everything upto and including the last '.' is removed. eg: "java.lang.String[]" -> "String[]" "java.util.ArrayList" -> "ArrayList"



canProduceNoXMLMetaChars
public static boolean canProduceNoXMLMetaChars(String className)(Code)



checkValueToType
public static boolean checkValueToType(String type, String value)(Code)
checkValueToType will make sure that a given value is acceptable for a given type. To make the problem more tractable, this is limited to simple types. eg: ("java.lang.Integer", "1") -> true ("java.lang.Integer", "1.5") -> false ("java.lang.String", "ksadjflkjas24#@") -> true ("short", "12345") -> true ("short", "123456") -> false Note that the 'tostr' template in javaGenLibrary.xsl has very similar code and any changes should be made there too.



compareTo
public static String compareTo(String value1, String type1, String value2)(Code)
Convert @param value2 (a literal) to @param type1 and then compare that to @param value1. Java code in a String, that returns negative, 0, or positiveif value1 < value2, value1 == value2, or value1 > value2.("foo", "java.math.BigDecimal", "1") -> 'foo.compareTo(new java.math.BigDecimal("1"))'



compareToText
public static String compareToText(String value1, String type1, String value2Text)(Code)
Just like compareTo, but the second value (@param value2Text) is unquoted text.



copyStream
public static int copyStream(Writer out, Reader in) throws java.io.IOException(Code)
copyStream is not really a Java Utility method, but it's needed by one of them, and so is here. the total length of the stream (in char's) copied.



copyStream
public static int copyStream(OutputStream out, InputStream in) throws java.io.IOException(Code)
copyStream is not really a Java Utility method, but it's needed by one of them, and so is here. the total length of the stream (in char's) copied.



escapeCharForInstance
public static String escapeCharForInstance(char c, char illegalChar)(Code)
A helper method for instanceFrom. We escape 1 char at a time here.



exceptionsFromParsingText
public static List exceptionsFromParsingText(String type)(Code)
What exceptions might we encounter from doing the result of genParseText. These exceptions are ones that we'd have to declare.



exceptionsFromParsingText
public static List exceptionsFromParsingText(String type, boolean fromParsing)(Code)



exprToInt
public static String exprToInt(String type, String expr)(Code)
Given a scalar type, figure out how to make it into an int (ie, hash code).



fromObject
public static String fromObject(String type, String expr)(Code)

Parameters:
  expr - is an Object type, and we will convert itto a primitive.eg: ('java.lang.Double', expr) -> '(java.lang.Double) expr'eg: ('int', 'obj') -> '((java.lang.Integer)obj).intValue()'



fromObjectType
public static String fromObjectType(String classType)(Code)
Take a Java boxed object (like Integer) and return it's primitive type. Return the same type if there isn't a primitive version.



genEquals
public static String genEquals(String type, String attr1, String attr2)(Code)
an expression to compare to expressions; this can be put rightinto an if statement.('int', 'var1', 'var2') -> 'var1 == var2'('String', 'word', '"hello"') -> 'word == null ? "hello" == null : word.equals("hello")'('float', 'var1', 'var2') -> 'Float.floatToIntBits(var1) == Float.floatToIntBits(var2)'



genEquals
public static String genEquals(String type, String attr1, String attr2, boolean attr1CanBeNull)(Code)

Parameters:
  attr1CanBeNull - whether or not attr1 could be null.



genNewDefault
public static String genNewDefault(String type)(Code)

Parameters:
  type - is the name of a class a default value for that type.eg: X -> new X()java.math.BigDecimal -> new java.math.BigDecimal("0")Integer -> new Integer("0")



genParseText
public static String genParseText(String type, String expr, boolean j2me)(Code)



genParseText
public static String genParseText(String type, String expr)(Code)
Take a particular @param type (eg: "java.lang.Integer") and return a String that will parse the @param expr and make it into that type. The value of @param expr should be a String. eg: ('java.lang.Integer', 'node.getNodeValue()') -> 'new java.lang.Integer(node.getNodeValue())'



genParseText
public static String genParseText(String type, String expr, String var)(Code)
Take a particular @param type (eg: "java.lang.Integer") and return a String that will parse the @param expr, making it into that type, and storing the value into @param var. The value of @param expr should be a String.



genParseText
public static String genParseText(String type, String expr, String var, boolean j2me)(Code)



genParseTextME
public static String genParseTextME(String type, String name)(Code)
Take a particular @param type (eg: "java.lang.Integer") and return a String that will parse the @param expr and make it into that type. The value of @param expr should be a String. These work in *MIDP/J2ME*. eg: ('java.lang.Integer', 'node.getNodeValue()') -> 'new java.lang.Integer(node.getNodeValue())'



getCanonicalClassName
public static String getCanonicalClassName(Class cls)(Code)



getOptimialHashMapSize
public static int getOptimialHashMapSize(Object[] keys)(Code)



getOptimialHashMapSize
public static int getOptimialHashMapSize(Object[] keys, int maxSize)(Code)
Using reflection figure out the optimal initial capacity for a HashMap given some keys. This uses a load factor of 1.0f. By optimal, the table does not need resizing and there are no lists (or chaining) being done in a HashMap.Entry.
Parameters:
  maxSize - the point at which to give up (the maximum size to try)



getPrimitive
public static Class getPrimitive(String className)(Code)



instanceFrom
public static String instanceFrom(String type, String value)(Code)
Take a String (@param value) and generate Java code to coerce it. eg: ('String', "Hello") -> '"Hello"' ('int', '10') -> '10' ('Integer', '43') -> 'new Integer(43)' ('java.util.Locale', 'Locale.US') -> 'Locale.US'



isCloneable
public static boolean isCloneable(String className)(Code)
Looks for the class and sees if it's cloneable.



isImmutable
public static boolean isImmutable(String className)(Code)
Is @param className immutable? An immutable object can hold state, but after it's been constructed that state cannot change.



isInstantiable
public static boolean isInstantiable(String className)(Code)
Is the class not an interface and not abstract; i.e., it's possible to call a constructor on this class. (Note that primitives fail.)



isPrimitiveType
public static boolean isPrimitiveType(String className)(Code)



native2ascii
public static void native2ascii(Writer out, Reader in) throws java.io.IOException(Code)



nullValueForType
public static String nullValueForType(String type)(Code)



reservedWord
public static boolean reservedWord(String name)(Code)



toObject
public static String toObject(String expr, String classType)(Code)
Convert primitives into Objects and leave objects as is.
Parameters:
  expr - the text expression representing some value
Parameters:
  classType - the current type of @param expr('age', 'int') -> 'new java.lang.Integer(age)'('age', 'Integer') -> 'age'



toObject
public static String toObject(String expr, String classType, boolean j2me)(Code)



toObjectType
public static String toObjectType(String classType)(Code)
Take a Java primitive and return it's object type. Return the same type if there isn't an object version.



typeToString
public static String typeToString(String type, String expr)(Code)
Convert expr into a String. Similar to toObject.
Parameters:
  expr - the value to convert into a String
Parameters:
  type - is the name of the current type('String', 'value') -> 'value'('int', '42') -> '""+42'('Integer', 'age') -> 'age.toString()'



uencode
public static String uencode(char c)(Code)
Take a character and return the \ u (Unicode) representation of it.



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.