1/* 2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { ClassSignature, FieldSignature, FileSignature, MethodSignature, MethodSubSignature } from '../ArkSignature'; 17import { UnknownType } from '../../base/Type'; 18 19export class ArkSignatureBuilder { 20 public static buildMethodSignatureFromClassNameAndMethodName(className: string, methodName: string, staticFlag: boolean = false): MethodSignature { 21 const classSignature = this.buildClassSignatureFromClassName(className); 22 const methodSubSignature = this.buildMethodSubSignatureFromMethodName(methodName, staticFlag); 23 return new MethodSignature(classSignature, methodSubSignature); 24 } 25 26 public static buildMethodSignatureFromMethodName(methodName: string, staticFlag: boolean = false): MethodSignature { 27 const methodSubSignature = this.buildMethodSubSignatureFromMethodName(methodName, staticFlag); 28 return new MethodSignature(ClassSignature.DEFAULT, methodSubSignature); 29 } 30 31 public static buildMethodSubSignatureFromMethodName(methodName: string, staticFlag: boolean = false): MethodSubSignature { 32 return new MethodSubSignature(methodName, [], UnknownType.getInstance(), staticFlag); 33 } 34 35 public static buildClassSignatureFromClassName(className: string): ClassSignature { 36 return new ClassSignature(className, FileSignature.DEFAULT); 37 } 38 39 public static buildFieldSignatureFromFieldName(fieldName: string, staticFlag: boolean = false): FieldSignature { 40 return new FieldSignature(fieldName, ClassSignature.DEFAULT, UnknownType.getInstance(), staticFlag); 41 } 42} 43