Selaa lähdekoodia

reflective: construct

Ranides Atterwim 10 vuotta sitten
vanhempi
commit
3698455105

+ 7 - 2
assira/src/main/java/net/ranides/assira/reflection/impl/FArgument.java

@@ -9,6 +9,7 @@ package net.ranides.assira.reflection.impl;
 
 import java.lang.reflect.Parameter;
 import java.util.Map;
+import net.ranides.assira.reflection.IArgument;
 import net.ranides.assira.reflection.IClass;
 import net.ranides.assira.reflection.IContext;
 import net.ranides.assira.reflection.IMethod;
@@ -17,7 +18,11 @@ import net.ranides.assira.reflection.IMethod;
  *
  * @author Ranides Atterwim <ranides@gmail.com>
  */
-public class FArgument {
+public final class FArgument {
+    
+    private FArgument() {
+        /* utility class */
+    }
 
     public static CArgument newArgument(String name, IClass type) {
         return new CArgument(name, type);
@@ -35,7 +40,7 @@ public class FArgument {
         return newArgument(entry.getKey(), entry.getValue());
     }
     
-    public static RArgument newArgument(IContext context, IMethod parent, Parameter param) {
+    public static IArgument newArgument(IContext context, IMethod parent, Parameter param) {
         return new RArgument(context, parent, param);
     }
     

+ 5 - 1
assira/src/main/java/net/ranides/assira/reflection/impl/FClass.java

@@ -18,9 +18,13 @@ import net.ranides.assira.reflection.IContext;
  *
  * @author Ranides Atterwim <ranides@gmail.com>
  */
-public class FClass {
+public final class FClass {
     
     private static final FCache<IClass> CACHE = new FCache<>();
+    
+    private FClass() {
+        /* utility class */
+    }
        
     public static IClass newClass(IContext context, Class<?> type) {
         return CACHE.get(context, type, () -> new RClass(context, type));

+ 5 - 1
assira/src/main/java/net/ranides/assira/reflection/impl/FElements.java

@@ -29,7 +29,11 @@ import net.ranides.assira.reflection.util.AnnotationUtils;
  *
  * @author Ranides Atterwim <ranides@gmail.com>
  */
-public class FElements {
+public final class FElements {
+    
+    private FElements() {
+        /* utility class */
+    }
 
     public static AAnnotations newAnnotations(IHints hints, CQuery<Annotation> stream) {
         return new AAnnotations(hints, stream);

+ 5 - 2
assira/src/main/java/net/ranides/assira/reflection/impl/FField.java

@@ -15,13 +15,16 @@ import net.ranides.assira.reflection.IField;
  *
  * @author Ranides Atterwim <ranides@gmail.com>
  */
-public class FField {
+public final class FField {
     
     private static final Cache<Object, IField> D_CACHE = new Cache<>();
     private static final Cache<Object, IField> R_CACHE = new Cache<>();
+    
+    private FField() {
+        /* utility class */
+    }
 
     public static IField newField(boolean declared, Field field) {
-//         return new RField(declared, field);
         return (declared ? D_CACHE : R_CACHE).get(field, () -> new RField(declared, field));
     }
     

+ 5 - 1
assira/src/main/java/net/ranides/assira/reflection/impl/FMethod.java

@@ -20,11 +20,15 @@ import net.ranides.assira.reflection.IMethod;
  *
  * @author Ranides Atterwim <ranides@gmail.com>
  */
-public class FMethod {
+public final class FMethod {
     
     private static final FCache<IMethod> D_METHODS = new FCache<>();
     private static final FCache<IMethod> R_METHODS = new FCache<>();
     private static final Cache<Object, IMethod> FUNCTIONS = new Cache<>();
+    
+    private FMethod() {
+        /* utility class */
+    }
 
     public static IMethod newMethod(boolean declared, IContext context, Method method) {
         return (declared ? D_METHODS : R_METHODS).get(context, method, () -> new RMethod(declared, context, method, null));

+ 0 - 5
assira/src/main/java/net/ranides/assira/reflection/impl/RMethod.java

@@ -67,11 +67,6 @@ public class RMethod extends AMethod implements IMethod {
         return FElements.newArguments(AHints.EMPTY, method.getParameterCount(), CQueryBuilder.fromArray(method.getParameters()).map(a -> FArgument.newArgument(c, this, a)));
 	}
     
-    CQuery<IArgument> $arguments() {
-        IContext c = context();
-        return CQueryBuilder.fromArray(method.getParameters()).map(a -> FArgument.newArgument(c, this, a));
-	}
-
 	@Override
 	public IClass parent() {
 		return context().typeinfo(method.getDeclaringClass());