void JPField::setStaticAttribute(HostRef* val) { TRACE_IN("JPField::setStaticAttribute"); if (m_IsFinal) { stringstream err; err << "Field " << m_Name << " is read-only"; RAISE(JPypeException, err.str().c_str()); } JPType* type = JPTypeManager::getType(m_Type); if (type->canConvertToJava(val) <= _explicit) { stringstream err; err << "unable to convert to " << type->getName().getSimpleName(); RAISE(JPypeException, err.str().c_str()); } JPCleaner cleaner; jclass claz = m_Class->getClass(); cleaner.addLocal(claz); type->setStaticValue(claz, m_FieldID, val); TRACE_OUT; }
vector<HostRef*> JPArray::getRange(int start, int stop) { TRACE_IN("JPArray::getRange"); JPType* compType = m_Class->getComponentType(); TRACE2("Component type", compType->getName().getSimpleName()); vector<HostRef*> res = compType->getArrayRange(m_Object, start, stop-start); return res; TRACE_OUT; }
void JPField::setAttribute(jobject inst, HostRef* val) { TRACE_IN("JPField::setAttribute"); if (m_IsFinal) { stringstream err; err << "Field " << m_Name << " is read-only"; RAISE(JPypeException, err.str().c_str()); } JPType* type = JPTypeManager::getType(m_Type); if (type->canConvertToJava(val) <= _explicit) { stringstream err; err << "unable to convert to " << type->getName().getSimpleName(); RAISE(JPypeException, err.str().c_str()); } type->setInstanceValue(inst, m_FieldID, val); TRACE_OUT; }