Class VmClass

java.lang.Object
org.pkl.core.runtime.VmValue
org.pkl.core.runtime.VmClass

public final class VmClass extends VmValue
  • Constructor Details

    • VmClass

      public VmClass(com.oracle.truffle.api.source.SourceSection sourceSection, com.oracle.truffle.api.source.SourceSection headerSection, com.oracle.truffle.api.source.SourceSection @Nullable [] docComment, List<VmTyped> annotations, int modifiers, PClassInfo<?> classInfo, List<TypeParameter> typeParameters, VmTyped prototype)
  • Method Details

    • initSupertype

      public void initSupertype(TypeNode supertypeNode, VmClass superclass)
    • addProperty

      public void addProperty(ClassProperty property)
    • addProperties

      public void addProperties(Iterable<ClassProperty> properties)
    • addMethod

      public void addMethod(ClassMethod method)
    • addMethods

      public void addMethods(Iterable<ClassMethod> methods)
    • notifyInitialized

      public void notifyInitialized()
    • getTypeParameterCount

      public int getTypeParameterCount()
    • getDeclaredProperty

      @Nullable public @Nullable ClassProperty getDeclaredProperty(Identifier name)
      Returns the property with the given name declared in this class, or null if no such property was found. Does return local properties.
    • getDeclaredProperties

      public Iterable<ClassProperty> getDeclaredProperties()
      Returns all properties declared in this class. Does include local properties.
    • getVmClass

      public VmClass getVmClass()
      Specified by:
      getVmClass in class VmValue
    • getSourceSection

      public com.oracle.truffle.api.source.SourceSection getSourceSection()
    • getHeaderSection

      public com.oracle.truffle.api.source.SourceSection getHeaderSection()
    • getDocComment

      public com.oracle.truffle.api.source.SourceSection @Nullable [] getDocComment()
    • getAnnotations

      public List<VmTyped> getAnnotations()
    • getModuleName

      public String getModuleName()
    • getModule

      public VmTyped getModule()
      Returns the module that this class is declared in. For a module class, returns the corresponding module.
    • getModuleMirror

      public VmTyped getModuleMirror()
    • getSimpleName

      public String getSimpleName()
    • getQualifiedName

      public String getQualifiedName()
      Returns the qualified name of this class, `#`. Note that a qualified class name isn't guaranteed to be unique, especially if the module name is not declared but inferred.
    • getDisplayName

      public String getDisplayName()
    • getPClassInfo

      public PClassInfo<?> getPClassInfo()
    • isHiddenProperty

      public boolean isHiddenProperty(Object key)
    • getProperty

      @Nullable public @Nullable ClassProperty getProperty(Identifier name)
      Returns the property with the given name declared in this class or a superclass, or null if no such property was found. Does not return local properties.
    • hasProperty

      public boolean hasProperty(Identifier name)
      Shorthand for getProperty(name) != null.
    • getAllRegularPropertyNames

      public org.graalvm.collections.UnmodifiableEconomicSet<Object> getAllRegularPropertyNames()
      Returns the names of all non-hidden non-local non-external properties defined in this class and its superclasses.
    • getAllHiddenPropertyNames

      public org.graalvm.collections.UnmodifiableEconomicSet<Object> getAllHiddenPropertyNames()
      Returns the names of all hidden properties defined in this class and its superclasses.
    • hasDeclaredMethod

      public boolean hasDeclaredMethod(Identifier name)
      Includes local methods.
    • getDeclaredMethod

      @Nullable public @Nullable ClassMethod getDeclaredMethod(Identifier name)
      Does return local methods.
    • getDeclaredMethods

      public Iterable<ClassMethod> getDeclaredMethods()
      Includes local methods.
    • getMethod

      @Nullable public @Nullable ClassMethod getMethod(Identifier name)
      Does not return local methods.
    • getMethods

      public Iterable<ClassMethod> getMethods()
      Does not include local methods.
    • getSuperclass

      @Nullable public @Nullable VmClass getSuperclass()
    • getPrototype

      public VmTyped getPrototype()
      Overrides:
      getPrototype in class VmValue
    • isAbstract

      public boolean isAbstract()
    • isExternal

      public boolean isExternal()
    • isOpen

      public boolean isOpen()
    • isClosed

      public boolean isClosed()
    • isInstantiable

      public boolean isInstantiable()
    • isNullClass

      public boolean isNullClass()
    • isCollectionClass

      public boolean isCollectionClass()
    • isListClass

      public boolean isListClass()
    • isSetClass

      public boolean isSetClass()
    • isMapClass

      public boolean isMapClass()
    • isListingClass

      public boolean isListingClass()
    • isMappingClass

      public boolean isMappingClass()
    • isDynamicClass

      public boolean isDynamicClass()
    • isPairClass

      public boolean isPairClass()
    • isFunctionClass

      public boolean isFunctionClass()
    • isFunctionNClass

      public boolean isFunctionNClass()
    • isModuleClass

      public boolean isModuleClass()
    • isClassClass

      public boolean isClassClass()
    • isVarArgsClass

      public boolean isVarArgsClass()
    • isSuperclassOf

      public boolean isSuperclassOf(VmClass other)
    • isSubclassOf

      public boolean isSubclassOf(VmClass other)
    • visitMethodDefsTopDown

      public void visitMethodDefsTopDown(Consumer<ClassMethod> visitor)
    • force

      public void force(boolean allowUndefinedValues)
      Description copied from class: VmValue
      Forces recursive (deep) evaluation of this value.
      Specified by:
      force in class VmValue
    • getMirror

      public VmTyped getMirror()
    • getTypedToDynamicMembers

      public org.graalvm.collections.EconomicMap<Object,ObjectMember> getTypedToDynamicMembers()
    • getDynamicToTypedMembers

      public org.graalvm.collections.EconomicMap<Object,ObjectMember> getDynamicToTypedMembers()
    • getMapToTypedMembers

      public org.graalvm.collections.EconomicMap<Object,ObjectMember> getMapToTypedMembers()
    • getModifierMirrors

      public VmSet getModifierMirrors()
    • getTypeParameterMirrors

      public VmList getTypeParameterMirrors()
    • getSuperclassMirror

      public VmValue getSuperclassMirror()
    • getSupertypeMirror

      public VmValue getSupertypeMirror()
    • getPropertyMirrors

      public VmMap getPropertyMirrors()
    • getAllPropertyMirrors

      public VmMap getAllPropertyMirrors()
    • getMethodMirrors

      public VmMap getMethodMirrors()
    • getAllMethodMirrors

      public VmMap getAllMethodMirrors()
    • export

      public PClass export()
      Specified by:
      export in class VmValue
    • accept

      public void accept(VmValueVisitor visitor)
      Specified by:
      accept in class VmValue
    • accept

      public <T> T accept(VmValueConverter<T> converter, Iterable<Object> path)
      Specified by:
      accept in class VmValue
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable @Nullable Object obj)
      Description copied from class: VmValue
      Enables calling `vmValue.equals()` when not behind a Truffle boundary.
      Specified by:
      equals in class VmValue
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object