gnu.kawa.reflect

Class SlotGet

Implemented Interfaces:
CanInline, HasSetter, Inlineable, Named

public class SlotGet
extends Procedure2
implements HasSetter, CanInline, Inlineable

Field Summary

static SlotGet
field
static SlotGet
slotRef
static SlotGet
staticField

Constructor Summary

SlotGet(String name, boolean isStatic)
SlotGet(String name, boolean isStatic, Procedure setter)

Method Summary

Object
apply2(Object arg1, Object arg2)
void
compile(ApplyExp exp, Compilation comp, Target target)
static Object
field(Object obj, String fname)
Type
getReturnType(Expression[] args)
Procedure
getSetter()
static Object
getSlotValue(boolean isStatic, Object obj, String name, String fname, String getName, String isName, Language language)
The actual gets of finding the field value.
Expression
inline(ApplyExp exp, ExpWalker walker)
static Member
lookupMember(ClassType clas, String name, ClassType caller)
Get a named property - field or 'get' accessor method.
static ApplyExp
makeGetField(Expression value, String fieldName)
Convenience method to make an Expression that gets the value of a field.
void
set2(Object obj, Object name, Object value)
void
setN(Object[] args)
static Object
staticField(Object obj, String fname)

Methods inherited from class gnu.mapping.Procedure2

apply0, apply1, apply2, apply3, apply4, applyN, numArgs

Methods inherited from class gnu.mapping.Procedure

apply, apply, apply0, apply1, apply2, apply3, apply4, applyN, check0, check1, check2, check3, check4, checkArgCount, checkN, getSetter, getSourceLocation, match0, match1, match2, match3, match4, matchN, maxArgs, minArgs, numArgs, set0, set1, setN, setSetter, setSourceLocation, toString

Methods inherited from class gnu.mapping.PropertySet

getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol

Field Details

field

public static final SlotGet field

slotRef

public static final SlotGet slotRef

staticField

public static final SlotGet staticField

Constructor Details

SlotGet

public SlotGet(String name,
               boolean isStatic)

SlotGet

public SlotGet(String name,
               boolean isStatic,
               Procedure setter)

Method Details

apply2

public Object apply2(Object arg1,
                     Object arg2)
Overrides:
apply2 in interface Procedure2

compile

public void compile(ApplyExp exp,
                    Compilation comp,
                    Target target)
Specified by:
compile in interface Inlineable

field

public static Object field(Object obj,
                           String fname)

getReturnType

public Type getReturnType(Expression[] args)
Specified by:
getReturnType in interface Inlineable

getSetter

public Procedure getSetter()
Specified by:
getSetter in interface HasSetter
Overrides:
getSetter in interface Procedure

getSlotValue

public static Object getSlotValue(boolean isStatic,
                                  Object obj,
                                  String name,
                                  String fname,
                                  String getName,
                                  String isName,
                                  Language language)
The actual gets of finding the field value. The compiler emits calls to this method if the field name is literals but the actual field is not known at compile time. This speeds lookup a bit.

inline

public Expression inline(ApplyExp exp,
                         ExpWalker walker)
Specified by:
inline in interface CanInline

lookupMember

public static Member lookupMember(ClassType clas,
                                  String name,
                                  ClassType caller)
Get a named property - field or 'get' accessor method.
Parameters:
clas - the class type declaring the property.
name - the source (unmangled) name of the property.

makeGetField

public static ApplyExp makeGetField(Expression value,
                                    String fieldName)
Convenience method to make an Expression that gets the value of a field.
Parameters:
value - evaluates to object that has the named field
fieldName - name of field in value
Returns:
expression that get the name field from value

set2

public void set2(Object obj,
                 Object name,
                 Object value)

setN

public void setN(Object[] args)
Overrides:
setN in interface Procedure

staticField

public static Object staticField(Object obj,
                                 String fname)