|
|
@@ -0,0 +1,104 @@
|
|
|
+package net.ranides.assira.reflection.impl;
|
|
|
+
|
|
|
+import net.ranides.assira.reflection.*;
|
|
|
+
|
|
|
+import java.lang.invoke.MethodHandle;
|
|
|
+import java.lang.reflect.Method;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.List;
|
|
|
+import java.util.NoSuchElementException;
|
|
|
+
|
|
|
+public class SMethod extends AMethod implements IMethod {
|
|
|
+
|
|
|
+ private static final String NSE = "Symbolic IMethod is not reflective nor callable.";
|
|
|
+
|
|
|
+ private static final IAttributes ATTRS = IAttributes.of(IAttribute.SYMBOLIC).immutable();
|
|
|
+
|
|
|
+ private final String name;
|
|
|
+
|
|
|
+ private final IArguments args;
|
|
|
+
|
|
|
+ private final IClass<?> rets;
|
|
|
+
|
|
|
+ public SMethod(String name, IArguments args, IClass<?> rets) {
|
|
|
+ super(IContext.DEFAULT);
|
|
|
+ this.name = name;
|
|
|
+ this.args = args;
|
|
|
+ this.rets = rets;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IMethod accessible() {
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Method reflective() {
|
|
|
+ throw new UnsupportedOperationException(NSE);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<IClass<?>> params() {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IClass<?> returns() {
|
|
|
+ return rets;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IArguments arguments() {
|
|
|
+ return args;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<IClass<?>> exceptions() {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IClass<?> parent() {
|
|
|
+ return IClass.NULL;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object invoke() {
|
|
|
+ throw new UnsupportedOperationException(NSE);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object invoke(Object that) {
|
|
|
+ throw new UnsupportedOperationException(NSE);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object invoke(Object that, Object... arguments) {
|
|
|
+ throw new UnsupportedOperationException(NSE);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object call(Object... arguments) {
|
|
|
+ throw new UnsupportedOperationException(NSE);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public MethodHandle handle() {
|
|
|
+ throw new UnsupportedOperationException(NSE);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String name() {
|
|
|
+ return name;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IAttributes attributes() {
|
|
|
+ return ATTRS;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IAnnotations annotations() {
|
|
|
+ return AAnnotations.EMPTY;
|
|
|
+ }
|
|
|
+}
|