Package st.gravel.support.jvm

Source Code of st.gravel.support.jvm.ReflectionExtensions

package st.gravel.support.jvm;

import st.gravel.support.compiler.ast.ClassMapping;
import st.gravel.support.compiler.ast.PackageNode;
import st.gravel.support.jvm.runtime.ImageBootstrapper;

public class ReflectionExtensions {

  public static ObjectMirror reflect_(Object receiver, Object object) {
    return new ObjectMirror(object);
  }

  public static Object packages(Object receiver) {
    return ArrayExtensions.collect_(ImageBootstrapper.systemMapping.systemDefinitionNode().packageNodes(), new Block1<PackageMirror, PackageNode>() {
     
      @Override
      public PackageMirror value_(PackageNode packageNode) {
        return new PackageMirror(packageNode.name());
      }
    } );
  }

  public static ClassDescriptionMirror getClassMirror(
      Class<? extends Object> aClass) {
    ClassMapping classMapping = ImageBootstrapper.systemMapping
        .classMappingForJavaClass_(aClass);
    return ClassDescriptionMirror.forReference(classMapping.reference());
  }

  public static ClassDescriptionMirror getNilClassMirror() {
    ClassMapping classMapping = ImageBootstrapper.systemMapping
        .nilClassMapping();
    return ClassDescriptionMirror.forReference(classMapping.reference());
  }
}
TOP

Related Classes of st.gravel.support.jvm.ReflectionExtensions

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.