package openperipheral.adapter.wrappers;

import java.lang.reflect.Method;
import java.util.List;

import openperipheral.adapter.IMethodCall;
import openperipheral.adapter.IMethodExecutor;
import openperipheral.adapter.method.MethodDeclaration;
import openperipheral.adapter.property.PropertyListBuilder;

public class InlineAdapterWrapper extends AdapterWrapper {

	public InlineAdapterWrapper(Class<?> rootClass, Class<?> targetClass, String source) {
		super(targetClass, targetClass, rootClass, source);
	}

	@Override
	public boolean canUse(Class<?> cls) {
		return true;
	}

	@Override
	public String describe() {
		return "internal (source: " + adapterClass.toString() + ")";
	}

	@Override
	protected void prepareDeclaration(MethodDeclaration decl) {}

	@Override
	public IMethodExecutor createExecutor(Method method, MethodDeclaration decl) {
		return new MethodExecutorBase(decl, method, metaInfo) {
			@Override
			public IMethodCall startCall(Object target) {
				return super.startCall(target);
			}
		};
	}

	@Override
	protected List<IMethodExecutor> buildMethodList() {
		List<IMethodExecutor> result = super.buildMethodList();
		PropertyListBuilder.buildPropertyList(rootClass, targetClass, source, result);
		return result;
	}

}

@@ -92,16 +92,37 @@
 .List;%0A%0A
+import openmods.Log;%0A
 import o
@@ -1158,16 +1158,70 @@
 List();%0A
+%0A%09%09// non-fatal to avoid sideness annoyances%0A%09%09try %7B%0A%09
 %09%09Proper
@@ -1293,16 +1293,127 @@
 esult);%0A
+%09%09%7D catch (Exception e) %7B%0A%09%09%09Log.warn(e, %22Failed to get properties for class %25s, skipping%22, targetClass);%0A%09%09%7D%0A%0A
 %09%09return

Make property building exceptions non-fatal (closes #266)