Qore jni Module  1.2.0
org.qore.lang.reflection.Type Class Reference

Java wrapper for the Qore::Reflection::Type class in Qore. More...

Inheritance diagram for org.qore.lang.reflection.Type:
org.qore.jni.QoreObjectWrapper

Public Member Methods

 Type (QoreObject obj) throws Throwable
 creates the object as a wrapper for the Qore object
 
 Type (String typestr) throws Throwable
 Creates the type from the given string. More...
 
String getName () throws Throwable
 returns the type's name More...
 
boolean isEqual (Type type) throws Throwable
 Returns True if the Type object passed as an argument is equal to the current object; False if not. More...
 
boolean isOutputCompatible (Type type) throws Throwable
 Returns True if the output of the Type object passed as an argument is compatible with the return type if the current Type. More...
 
boolean isCompatible (Type type) throws Throwable
 Returns True if the argument type is compatible with the current type (inputs and outputs) More...
 
boolean isAssignableFrom (Type type) throws Throwable
 Returns True if the output of the Type object passed as an argument is compatible with the input type if the current Type. More...
 
Object acceptsValue (Object value) throws Throwable
 Returns the value after any conversions by the type. More...
 
int isAssignableFrom (Object value) throws Throwable
 Returns True if the Type object can be assigned from the value given as an argument. More...
 
int getBaseTypeCode () throws Throwable
 Returns the base type code for the type or Qore::NT_ALL for those that don't have types. More...
 
HashMap< String, Boolean > getAcceptTypeHash () throws Throwable
 Returns a hash of types accepted by this type. More...
 
HashMap< String, Boolean > getReturnTypeHash () throws Throwable
 Returns a hash of types returned by this type. More...
 
boolean canConvertToScalar () throws Throwable
 Returns True if values of this type can be converted to a scalar value. More...
 
boolean hasDefaultValue () throws Throwable
 Returns True if this type has a default value. More...
 
Object getDefaultValue () throws Throwable
 Returns the default value for the type or nothing if the type has no default value. More...
 
boolean isOrNothingType () throws Throwable
 Returns true if the type accepts and returns nothing in addition to other values. More...
 
Type getBaseType () throws Throwable
 Returns the base type for the current type; if the type is already a base type (i.e. not an "or nothing" type), then the same type is returned. More...
 
Type getOrNothingType () throws Throwable
 Returns the "or nothing" type for the current type; if the type is already an "or nothing" type (i.e. it already accepts nothing), then the same type is returned. More...
 
Type getElementType () throws Throwable
 Returns the element type for complex list and hash types, if any, otherwise returns nothing. More...
 
boolean isTypedHash () throws Throwable
 Returns true if the type is a TypedHash type, false if not. More...
 
boolean hasType () throws Throwable
 Returns true if the type is not a wildcard type; i.e. has type restrictions. More...
 
- Public Member Methods inherited from org.qore.jni.QoreObjectWrapper
 QoreObjectWrapper (QoreObject obj)
 creates the wrapper object with the Qore object
 
void release ()
 releases the Qore object; do not call any further methods on the object after this call
 
QoreObject getQoreObject ()
 returns the Qore object
 
String className ()
 returns the class name for the Qore object
 
boolean instanceOf (String class_name)
 returns true if the object is an instance of the given class
 

Static Public Member Methods

static Type getType (Object v) throws Throwable
 Returns the type object for the value. More...
 
static Type getOrNothingType (Object v) throws Throwable
 Returns the "or nothing" type object for the value. More...
 

Additional Inherited Members

- Private Attributes inherited from org.qore.jni.QoreObjectWrapper
QoreObject obj
 the wrapper Qore object
 

Detailed Description

Java wrapper for the Qore::Reflection::Type class in Qore.

Note
Loads and initializes the Qore library, the jni module, and the reflection module in static initialization if necessary

Constructor & Destructor Documentation

◆ Type()

org.qore.lang.reflection.Type.Type ( String  typestr) throws Throwable
inline

Creates the type from the given string.

Parameters
stringthe type string
Exceptions
UNKNOWN-TYPEcannot find the given type

Member Function Documentation

◆ acceptsValue()

Object org.qore.lang.reflection.Type.acceptsValue ( Object  value) throws Throwable
inline

Returns the value after any conversions by the type.

Example:
Object v1 = t1.acceptsValue(v0);
Parameters
valuethe value to assign to the type
Returns
the value to be assigned; can be converted by the type
Exceptions
RUNTIME-TYPE-ERRORif the value cannot be assigned to the type

◆ canConvertToScalar()

boolean org.qore.lang.reflection.Type.canConvertToScalar ( ) throws Throwable
inline

Returns True if values of this type can be converted to a scalar value.

Example:
boolean b = t.canConvertToScalar();
Returns
True if the output of the Type object passed as an argument is compatible with the return type if the current Type

◆ getAcceptTypeHash()

HashMap<String, Boolean> org.qore.lang.reflection.Type.getAcceptTypeHash ( ) throws Throwable
inline

Returns a hash of types accepted by this type.

Returns
a hash of types accepted by this type

◆ getBaseType()

Type org.qore.lang.reflection.Type.getBaseType ( ) throws Throwable
inline

Returns the base type for the current type; if the type is already a base type (i.e. not an "or nothing" type), then the same type is returned.

Example:
Object v = t.getBaseType();
Returns
the base type for the current type; if the type is already a base type (i.e. not an "or nothing" type), then the same type is returned
See also
getOrNothingType()

◆ getBaseTypeCode()

int org.qore.lang.reflection.Type.getBaseTypeCode ( ) throws Throwable
inline

Returns the base type code for the type or Qore::NT_ALL for those that don't have types.

Example:
int t = t.getBaseTypeCode();
Returns
the base type code for the type or Qore::NT_ALL for those that don't have types

◆ getDefaultValue()

Object org.qore.lang.reflection.Type.getDefaultValue ( ) throws Throwable
inline

Returns the default value for the type or nothing if the type has no default value.

Example:
Object v = t.getDefaultValue();
Returns
the default value for the type or nothing if the type has no default value

◆ getElementType()

Type org.qore.lang.reflection.Type.getElementType ( ) throws Throwable
inline

Returns the element type for complex list and hash types, if any, otherwise returns nothing.

Example:
*Type element_type = type.getElementType();
Returns
the element type for complex list and hash types, if any, otherwise returns nothing

◆ getName()

String org.qore.lang.reflection.Type.getName ( ) throws Throwable
inline

returns the type's name

Example:
String name = t.getName();
Returns
the type's name

◆ getOrNothingType() [1/2]

Type org.qore.lang.reflection.Type.getOrNothingType ( ) throws Throwable
inline

Returns the "or nothing" type for the current type; if the type is already an "or nothing" type (i.e. it already accepts nothing), then the same type is returned.

Example:
Object v = t.getOrNothingType();
Returns
the "or nothing" type for the current type; if the type is already an "or nothing" type (i.e. it already accepts nothing), then the same type is returned
See also
getBaseType()

◆ getOrNothingType() [2/2]

static Type org.qore.lang.reflection.Type.getOrNothingType ( Object  v) throws Throwable
inlinestatic

Returns the "or nothing" type object for the value.

Example:
Returns
the "or nothing" type object for the value

◆ getReturnTypeHash()

HashMap<String, Boolean> org.qore.lang.reflection.Type.getReturnTypeHash ( ) throws Throwable
inline

Returns a hash of types returned by this type.

Returns
a hash of types returned by this type

◆ getType()

static Type org.qore.lang.reflection.Type.getType ( Object  v) throws Throwable
inlinestatic

Returns the type object for the value.

Example:
Type t = getType(v);
Parameters
vthe value to return the type object for
Returns
the type object for the value

◆ hasDefaultValue()

boolean org.qore.lang.reflection.Type.hasDefaultValue ( ) throws Throwable
inline

Returns True if this type has a default value.

Example:
boolean b = t.canConvertToScalar();
Returns
True if this type has a default value

◆ hasType()

boolean org.qore.lang.reflection.Type.hasType ( ) throws Throwable
inline

Returns true if the type is not a wildcard type; i.e. has type restrictions.

Example:
boolean b = type.hasType();
Returns
true if the type is not a wildcard type; i.e. has type restrictions

◆ isAssignableFrom() [1/2]

int org.qore.lang.reflection.Type.isAssignableFrom ( Object  value) throws Throwable
inline

Returns True if the Type object can be assigned from the value given as an argument.

Example:
boolean b = t.isAssignableFrom(val);
Parameters
valuethe value to check
Returns
a match code for the assignment; see type_match_constants for possible values

◆ isAssignableFrom() [2/2]

boolean org.qore.lang.reflection.Type.isAssignableFrom ( Type  type) throws Throwable
inline

Returns True if the output of the Type object passed as an argument is compatible with the input type if the current Type.

Example:
int v = t1.isAssignableFrom(t2);
Parameters
typethe type to check output value compatibility with the current type
Returns
True if the output of the Type object passed as an argument is compatible with the input type if the current Type

◆ isCompatible()

boolean org.qore.lang.reflection.Type.isCompatible ( Type  type) throws Throwable
inline

Returns True if the argument type is compatible with the current type (inputs and outputs)

Example:
boolean b = t1.isCompatible(t2);
Parameters
typethe type to check compatibility with the current type
Returns
True if the argument type is compatible with the current type (inputs and outputs)
Note
a more strict check than isOutputCompatible()

◆ isEqual()

boolean org.qore.lang.reflection.Type.isEqual ( Type  type) throws Throwable
inline

Returns True if the Type object passed as an argument is equal to the current object; False if not.

Example:
boolean b = t1.isEqual(t2);
Parameters
typethe type to check with the current type for equality
Returns
True if the Type object passed as an argument is equal to the current object; False if not

◆ isOrNothingType()

boolean org.qore.lang.reflection.Type.isOrNothingType ( ) throws Throwable
inline

Returns true if the type accepts and returns nothing in addition to other values.

Example:
boolean b = type.isOrNothingType();
Returns
true if the type accepts and returns nothing in addition to other values

◆ isOutputCompatible()

boolean org.qore.lang.reflection.Type.isOutputCompatible ( Type  type) throws Throwable
inline

Returns True if the output of the Type object passed as an argument is compatible with the return type if the current Type.

Example:
boolean b = t1.isOutputCompatible(t2);
Parameters
typethe type to check output value compatibility with the current type
Returns
True if the output of the Type object passed as an argument is compatible with the return type if the current Type
See also
isCompatible()

◆ isTypedHash()

boolean org.qore.lang.reflection.Type.isTypedHash ( ) throws Throwable
inline

Returns true if the type is a TypedHash type, false if not.

Example:
boolean b = type.isTypedHash();
Returns
true if the type is a TypedHash type, false if not

The documentation for this class was generated from the following file:
org.qore.lang.reflection.Type.getOrNothingType
Type getOrNothingType()
Returns the "or nothing" type for the current type; if the type is already an "or nothing" type (i....
Definition: Type.java:249
org.qore.lang.reflection.Type.getType
static Type getType(Object v)
Returns the type object for the value.
Definition: Type.java:303
org.qore.lang.reflection.Type.Type
Type(QoreObject obj)
creates the object as a wrapper for the Qore object
Definition: Type.java:31