Member class abstract interface

Abstract base class representing a member of a class that extends Executable.

This class provides a default implementation for executable elements that are not actually executable (i.e., they don't accept parameters or arguments). It's typically used as a base class for class members like fields, properties, or other non-method elements that need to implement the Executable interface but don't have executable semantics.

Key Characteristics

  • Non-executable: All parameter-related methods return empty/false values
  • No Arguments: Cannot accept any positional or named arguments
  • No Parameters: Has no parameter definitions or metadata
  • Marker Implementation: Serves as a marker for non-executable class members

Usage

Extend this class for class members that implement Executable but are not methods:

class Field extends Member {
  final String name;
  final Class type;
  final dynamic value;
  
  Field(this.name, this.type, [this.value]);
  
  @override
  String getName() => name;
  
  @override
  Class getReturnType() => type;
}

Property Implementation

class Property extends Member {
  final String propertyName;
  final Class propertyType;
  final bool isReadOnly;
  
  Property(this.propertyName, this.propertyType, {this.isReadOnly = false});
  
  @override
  String getName() => propertyName;
  
  @override
  Class getReturnType() => propertyType;
  
  bool canWrite() => !isReadOnly;
}

Annotation Support

class AnnotatedMember extends Member {
  final List<Annotation> annotations;
  
  AnnotatedMember(this.annotations);
  
  bool hasDirectAnnotation<T>() {
    return annotations.any((a) => a is T);
  }
  
  T? getDirectAnnotation<T>() {
    return annotations.whereType<T>().firstOrNull;
  }
}
Implementers

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getDeclaringClass<D>() Class<D>
Gets the class that declares this method.
getReturnClass() Class<Object>
Gets the return type of the method.
getReturnType() Type
Gets the return type of the method.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited