Java Doc for Primitive.java in  » Scripting » beanshell » bsh » 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 » Scripting » beanshell » bsh 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   bsh.Primitive

Primitive
final public class Primitive implements ParserConstants,java.io.Serializable(Code)

Wrapper for primitive types in Bsh. This is package public because it is used in the implementation of some bsh commands.

See the note in LHS.java about wrapping objects.


author:
   Pat Niemeyer
author:
   Daniel Leuck


Field Summary
public static  PrimitiveFALSE
    
final public static  PrimitiveNULL
    
public static  PrimitiveTRUE
    
final public static  PrimitiveVOID
     VOID means "no type". Strictly speaking, this makes no sense here.
static  HashtablewrapperMap
    

Constructor Summary
public  Primitive(Object value)
    
public  Primitive(boolean value)
    
public  Primitive(byte value)
    
public  Primitive(short value)
    
public  Primitive(char value)
    
public  Primitive(int value)
    
public  Primitive(long value)
    
public  Primitive(float value)
    
public  Primitive(double value)
    

Method Summary
public static  ObjectbinaryOperation(Object obj1, Object obj2, int kind)
     Perform a binary operation on two Primitives or wrapper types.
static  ObjectbinaryOperationImpl(Object lhs, Object rhs, int kind)
    
static  BooleanbooleanBinaryOperation(Boolean B1, Boolean B2, int kind)
    
static  booleanbooleanUnaryOperation(Boolean B, int kind)
    
public  booleanbooleanValue()
    
public static  ClassboxType(Class primitiveType)
     Get the corresponding java.lang wrapper class for the primitive TYPE class. e.g.
static  PrimitivecastPrimitive(Class toType, Class fromType, Primitive fromValue, boolean checkOnly, int operation)
    
public  PrimitivecastToType(Class toType, int operation)
     Cast this bsh.Primitive value to a new bsh.Primitive value This is usually a numeric type cast.
static  ObjectcastWrapper(Class toType, Object value)
     Cast a primitive value represented by its java.lang wrapper type to the specified java.lang wrapper type.
static  ObjectdoubleBinaryOperation(Double D1, Double D2, int kind)
    
static  doubledoubleUnaryOperation(Double D, int kind)
    
public  booleanequals(Object obj)
     Primitives compare equal with other Primitives containing an equal wrapped value.
static  ObjectfloatBinaryOperation(Float F1, Float F2, int kind)
    
static  floatfloatUnaryOperation(Float F, int kind)
    
public static  PrimitivegetDefaultValue(Class type)
    
public  ClassgetType()
     Get the corresponding Java primitive TYPE class for this Primitive.
public  ObjectgetValue()
    
public  inthashCode()
     The hash of the Primitive is tied to the hash of the wrapped value but shifted so that they are not the same.
static  ObjectintBinaryOperation(Integer I1, Integer I2, int kind)
    
static  intintUnaryOperation(Integer I, int kind)
    
public  intintValue()
    
public  booleanisNumber()
     Determine if this primitive is a numeric type. i.e.
public static  booleanisWrapperType(Class type)
    
static  ObjectlongBinaryOperation(Long L1, Long L2, int kind)
    
static  longlongUnaryOperation(Long L, int kind)
    
public  NumbernumberValue()
    
static  Object[]promotePrimitives(Object lhs, Object rhs)
     Promote the pair of primitives to the maximum type of the two. e.g.
static  ObjectpromoteToInteger(Object wrapper)
    
public  StringtoString()
    
public static  PrimitiveunaryOperation(Primitive val, int kind)
    
public static  ClassunboxType(Class wrapperType)
     Get the corresponding primitive TYPE class for the java.lang wrapper class type. e.g.
public static  Objectunwrap(Object obj)
     Unwrap primitive values and map voids to nulls.
public static  Object[]unwrap(Object[] args)
    
public static  Object[]wrap(Object[] args, Class[] paramTypes)
    
public static  Objectwrap(Object value, Class type)
     Wrap primitive values (as indicated by type param) and nulls in the Primitive class.

Field Detail
FALSE
public static Primitive FALSE(Code)



NULL
final public static Primitive NULL(Code)



TRUE
public static Primitive TRUE(Code)



VOID
final public static Primitive VOID(Code)
VOID means "no type". Strictly speaking, this makes no sense here. But for practical reasons we'll consider the lack of a type to be a special value.



wrapperMap
static Hashtable wrapperMap(Code)




Constructor Detail
Primitive
public Primitive(Object value)(Code)



Primitive
public Primitive(boolean value)(Code)



Primitive
public Primitive(byte value)(Code)



Primitive
public Primitive(short value)(Code)



Primitive
public Primitive(char value)(Code)



Primitive
public Primitive(int value)(Code)



Primitive
public Primitive(long value)(Code)



Primitive
public Primitive(float value)(Code)



Primitive
public Primitive(double value)(Code)




Method Detail
binaryOperation
public static Object binaryOperation(Object obj1, Object obj2, int kind) throws UtilEvalError(Code)
Perform a binary operation on two Primitives or wrapper types. If both original args were Primitives return a Primitive result else it was mixed (wrapper/primitive) return the wrapper type. The exception is for boolean operations where we will return the primitive type either way.



binaryOperationImpl
static Object binaryOperationImpl(Object lhs, Object rhs, int kind) throws UtilEvalError(Code)



booleanBinaryOperation
static Boolean booleanBinaryOperation(Boolean B1, Boolean B2, int kind)(Code)



booleanUnaryOperation
static boolean booleanUnaryOperation(Boolean B, int kind) throws UtilEvalError(Code)



booleanValue
public boolean booleanValue() throws UtilEvalError(Code)



boxType
public static Class boxType(Class primitiveType)(Code)
Get the corresponding java.lang wrapper class for the primitive TYPE class. e.g. Integer.TYPE -> Integer.class



castPrimitive
static Primitive castPrimitive(Class toType, Class fromType, Primitive fromValue, boolean checkOnly, int operation) throws UtilEvalError(Code)



castToType
public Primitive castToType(Class toType, int operation) throws UtilEvalError(Code)
Cast this bsh.Primitive value to a new bsh.Primitive value This is usually a numeric type cast. Other cases include: A boolean can be cast to boolen null can be cast to any object type and remains null Attempting to cast a void causes an exception
Parameters:
  toType - is the java object or primitive TYPE class



castWrapper
static Object castWrapper(Class toType, Object value)(Code)
Cast a primitive value represented by its java.lang wrapper type to the specified java.lang wrapper type. e.g. Byte(5) to Integer(5) or Integer(5) to Byte(5)
Parameters:
  toType - is the java TYPE type
Parameters:
  value - is the value in java.lang wrapper.value may not be null.



doubleBinaryOperation
static Object doubleBinaryOperation(Double D1, Double D2, int kind) throws UtilEvalError(Code)



doubleUnaryOperation
static double doubleUnaryOperation(Double D, int kind)(Code)



equals
public boolean equals(Object obj)(Code)
Primitives compare equal with other Primitives containing an equal wrapped value.



floatBinaryOperation
static Object floatBinaryOperation(Float F1, Float F2, int kind) throws UtilEvalError(Code)



floatUnaryOperation
static float floatUnaryOperation(Float F, int kind)(Code)



getDefaultValue
public static Primitive getDefaultValue(Class type)(Code)
Get the appropriate default value per JLS 4.5.4



getType
public Class getType()(Code)
Get the corresponding Java primitive TYPE class for this Primitive. the primitive TYPE class type of the value or Void.TYPE forPrimitive.VOID or null value for type of Primitive.NULL



getValue
public Object getValue()(Code)
Return the primitive value stored in its java.lang wrapper class



hashCode
public int hashCode()(Code)
The hash of the Primitive is tied to the hash of the wrapped value but shifted so that they are not the same.



intBinaryOperation
static Object intBinaryOperation(Integer I1, Integer I2, int kind)(Code)



intUnaryOperation
static int intUnaryOperation(Integer I, int kind)(Code)



intValue
public int intValue() throws UtilEvalError(Code)



isNumber
public boolean isNumber()(Code)
Determine if this primitive is a numeric type. i.e. not boolean, null, or void (but including char)



isWrapperType
public static boolean isWrapperType(Class type)(Code)



longBinaryOperation
static Object longBinaryOperation(Long L1, Long L2, int kind)(Code)



longUnaryOperation
static long longUnaryOperation(Long L, int kind)(Code)



numberValue
public Number numberValue() throws UtilEvalError(Code)



promotePrimitives
static Object[] promotePrimitives(Object lhs, Object rhs)(Code)
Promote the pair of primitives to the maximum type of the two. e.g. [int,long]->[long,long]



promoteToInteger
static Object promoteToInteger(Object wrapper)(Code)
Promote primitive wrapper type to to Integer wrapper type



toString
public String toString()(Code)



unaryOperation
public static Primitive unaryOperation(Primitive val, int kind) throws UtilEvalError(Code)



unboxType
public static Class unboxType(Class wrapperType)(Code)
Get the corresponding primitive TYPE class for the java.lang wrapper class type. e.g. Integer.class -> Integer.TYPE



unwrap
public static Object unwrap(Object obj)(Code)
Unwrap primitive values and map voids to nulls. Non Primitive types remain unchanged.
Parameters:
  obj - object type which may be bsh.Primitive corresponding "normal" Java type, "unwrapping" any bsh.Primitive types to their wrapper types.



unwrap
public static Object[] unwrap(Object[] args)(Code)



wrap
public static Object[] wrap(Object[] args, Class[] paramTypes)(Code)



wrap
public static Object wrap(Object value, Class type)(Code)
Wrap primitive values (as indicated by type param) and nulls in the Primitive class. Values not primitive or null are left unchanged. Primitive values are represented by their wrapped values in param value.

The value null is mapped to Primitive.NULL. Any value specified with type Void.TYPE is mapped to Primitive.VOID.




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.