Beispiel #1
0
void JPClass::loadSuperInterfaces() 
{	
	JPCleaner cleaner;
	// Super interfaces
	vector<jclass> intf = JPJni::getInterfaces(m_Class);

	cleaner.addAllLocal(intf);

	for (vector<jclass>::iterator it = intf.begin(); it != intf.end(); it++)
	{
		JPTypeName intfName = JPJni::getName(*it);
		JPClass* intf = JPTypeManager::findClass(intfName);
		m_SuperInterfaces.push_back(intf);
	}
}
Beispiel #2
0
void JPClass::loadMethods() 
{	
	JPCleaner cleaner;
	JPCleaner pcleaner;

	// methods
	vector<jobject> methods = JPJni::getDeclaredMethods(m_Class);
	cleaner.addAllLocal(methods);

	for (vector<jobject>::iterator it = methods.begin(); it != methods.end(); it++)
	{
		string name = JPJni::getMemberName(*it);

		if (JPJni::isMemberPublic(*it) && !JPJni::isMemberAbstract(*it) )
		{
			JPMethod* method = getMethod(name);
			if (method == NULL)
			{
				method = new JPMethod(m_Class, name, false);
				m_Methods[name] = method; 
			}
			
			method->addOverload(this, *it);			
		
		
		}

		
	}

	// add previous overloads to methods defined in THIS class
	if (m_SuperClass != NULL)
	{
		for (map<string, JPMethod*>::iterator cur = m_Methods.begin(); cur != m_Methods.end(); cur ++)
		{
			string name = cur->first;
			JPMethod* superMethod = m_SuperClass->getMethod(name);
			if (superMethod != NULL)
			{
				cur->second->addOverloads(superMethod);
			}
		}
	}		
}
Beispiel #3
0
void JPClass::loadFields() 
{	
	JPCleaner cleaner;
	// fields
	vector<jobject> fields = JPJni::getDeclaredFields(m_Class);
	cleaner.addAllLocal(fields);

	for (vector<jobject>::iterator it = fields.begin(); it != fields.end(); it++)
	{
		JPField* field = new JPField(this, *it);
		if (field->isStatic())
		{
			m_StaticFields[field->getName()] = field;  
		}
		else
		{
			m_InstanceFields[field->getName()] = field;  
		}			
	}	
}
Beispiel #4
0
void JPClass::loadConstructors() 
{
	JPCleaner cleaner;

	m_Constructors = new JPMethod(m_Class, "[init", true); 

	if (JPJni::isAbstract(m_Class))
	{
		// NO constructor ...
		return;
	}

	
	vector<jobject> methods = JPJni::getDeclaredConstructors(m_Class);
	cleaner.addAllLocal(methods);

	for (vector<jobject>::iterator it = methods.begin(); it != methods.end(); it++)
	{
		if (JPJni::isMemberPublic(*it))
		{
			m_Constructors->addOverload(this, *it);
		}
	}
}