Interface Model
- All Known Subinterfaces:
AnnotatedModel,ErroneousModel,NamedModel,NameHoldingModel
- All Known Implementing Classes:
AbstractCaseLabelModel,AbstractExpressionModel,AbstractModel,AbstractPatternModel,AbstractStatementModel,AnnotationArgumentModel,AnnotationExpressionModel,AnyPatternModel,ArrayAccessExpressionModel,ArrayDeclarationExpressionModel,AssertStatementModel,AssignmentExpressionModel,BinaryExpressionModel,BindingPatternModel,BlockStatementModel,BreakStatementModel,CaseModel,CastExpressionModel,CatchModel,ClassModel,CompilationUnitModel,ConditionalExpressionModel,ConstCaseLabelModel,ContinueStatementModel,DeconstructionPatternModel,DefaultCaseLabelModel,DoWhileLoopStatementModel,EmptyStatementModel,EnhancedForLoopStatementModel,ErroneousExpressionModel,ErroneousExpressionStatementModel,ExpressionStatementModel,ForLoopStatementModel,GuardedPatternModel,IfStatementModel,ImplementsModel,ImportModel,InstanceofExpressionModel,LabeledStatementModel,LambdaExpressionModel,LiteralExpressionModel,MemberSelectExpressionModel,MethodBodyModel,MethodInvocationExpressionModel,MethodModel,MethodReferenceExpressionModel,ModifiersMapper.ModifiersParsePair,ModifiersModel,NameExpressionModel,NewClassExpressionModel,PackageModel,ParenthesizedExpressionModel,ParenthesizedPatternModel,PatternCaseLabelModel,PermitsModel,ReturnStatementModel,SwitchExpressionModel,SwitchStatementModel,SynchronizedStatementModel,ThrowStatementModel,TryStatementModel,TypeArgumentsMapper.Args,TypeModel,TypeModel.Array,TypeModel.NamedObject,TypeModel.Parameterized,TypeModel.Primitive,TypeModel.Union,TypeModel.Var,TypeModel.Wildcard,TypeParameterModel,UnaryExpressionModel,UnknownExpressionModel,UnknownPatternModel,UnknownStatementModel,VariableModel,WhileLoopStatementModel,YieldStatementModel
public interface Model
Base model type for all AST elements.
- Author:
- Matt Coley
-
Method Summary
Modifier and TypeMethodDescriptiondefault ModelgetChildAtPosition(int position) default <M extends Model>
MgetParentOfType(Class<M> type) getRange()getRecursiveChildrenOfType(Class<M> type) default Stringdefault booleandefault booleanisParentOf(Model model) default Resolutiondefault voidvisit(ModelVisitor visitor) Visits the current model and all children with the given visitor.
-
Method Details
-
resolve
- Parameters:
resolver- Resolver to utilize.- Returns:
- Resolution of what this model represents.
-
resolveAt
- Parameters:
resolver- Resolver to utilize.position- Absolute position in the source code of the item we want to resolve.- Returns:
- Resolution of what this model represents at the given position.
-
visit
Visits the current model and all children with the given visitor.- Parameters:
visitor- Visitor to observe this model and all children.
-
getChildAtPosition
- Parameters:
position- Absolute position in the source code.- Returns:
- Child contained by this model that contains the given position.
nullif no child contains the given point.
-
getRecursiveChildrenOfType
- Type Parameters:
M- Model type.- Parameters:
type- Model type to get.- Returns:
- List of all children at all depths that are assignable to the requested type.
-
getParentOfType
- Type Parameters:
M- Model type.- Parameters:
type- Model type to get.- Returns:
- The first parent in this model's hierarchy that is assignable to the requested type.
nullif no parent in the model matches.
-
isParentOf
- Parameters:
model- Model to check for as a child of this model.- Returns:
truewhen the given model is a child of this model.
-
isChildOf
- Parameters:
model- Model to check for as a parent of this model.- Returns:
truewhen the given model is a parent of this model.
-
getSource
- Parameters:
unit- Unit holding the original source code.- Returns:
- Substring of source code this model is backed by.
-
getChildren
- Returns:
- Direct child models.
-
getParent
- Returns:
- Direct parent model. Should only ever be
nullforCompilationUnitModel.
-
getRange
- Returns:
- Range within the source code this model originates from.
-