Package gw.lang.parser.coercers
Class FunctionFromInterfaceCoercer
- java.lang.Object
-
- gw.lang.parser.coercers.BaseCoercer
-
- gw.lang.parser.coercers.FunctionFromInterfaceCoercer
-
- All Implemented Interfaces:
ICoercer
public class FunctionFromInterfaceCoercer extends BaseCoercer
-
-
Field Summary
Fields Modifier and Type Field Description private static FunctionFromInterfaceCoercer_instance-
Fields inherited from interface gw.lang.parser.ICoercer
MAX_PRIORITY
-
-
Constructor Summary
Constructors Modifier Constructor Description privateFunctionFromInterfaceCoercer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanareTypesCompatible(IFunctionType functionType, IType interfaceType)java.lang.ObjectcoerceValue(IType typeToCoerceTo, java.lang.Object value)static java.lang.ObjectdoCoercion(java.lang.Class classToCoerceTo, java.lang.Class ifaceClass, java.lang.Object value)private static java.lang.reflect.MethodfindSingleAbstractMethod(java.lang.Class ifaceClass)intgetPriority(IType to, IType from)booleanhandlesNull()static FunctionFromInterfaceCoercerinstance()booleanisExplicitCoercion()
-
-
-
Field Detail
-
_instance
private static FunctionFromInterfaceCoercer _instance
-
-
Method Detail
-
instance
public static FunctionFromInterfaceCoercer instance()
-
handlesNull
public boolean handlesNull()
- Returns:
- true if this coercer knows how to handle the null value.
-
coerceValue
public java.lang.Object coerceValue(IType typeToCoerceTo, java.lang.Object value)
-
doCoercion
public static java.lang.Object doCoercion(java.lang.Class classToCoerceTo, java.lang.Class ifaceClass, java.lang.Object value)
-
findSingleAbstractMethod
private static java.lang.reflect.Method findSingleAbstractMethod(java.lang.Class ifaceClass)
-
isExplicitCoercion
public boolean isExplicitCoercion()
-
areTypesCompatible
public static boolean areTypesCompatible(IFunctionType functionType, IType interfaceType)
-
getPriority
public int getPriority(IType to, IType from)
- Returns:
- a value between 0 and MAX_PRIORITY, inclusive that indicates the priority of this coercer when resolving overloaded methods. Typically a coercer should return 0, but coercers that have a high affinity between the target and coerced type, such as primitives, can have higher priorities.
-
-