/
jmethod.go
53 lines (47 loc) · 1.1 KB
/
jmethod.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package domain
import (
"github.com/phodal/coca/core/infrastructure"
"strings"
)
type JMethod struct {
Name string
Type string
StartLine int
StartLinePosition int
StopLine int
StopLinePosition int
Parameters []JParameter
MethodCalls []JMethodCall
Override bool
Annotations []Annotation
IsConstructor bool
IsReturnNull bool
Modifiers []string
Creators []JClassNode
}
func NewJMethod() JMethod {
return *&JMethod{
Name: "",
Type: "",
Annotations: nil,
StartLine: 0,
StartLinePosition: 0,
StopLine: 0,
StopLinePosition: 0,
Parameters: nil,
MethodCalls: nil,
IsConstructor: false,
}
}
func (m *JMethod) IsStatic() bool {
return infrastructure.StringArrayContains(m.Modifiers, "static")
}
func (m *JMethod) IsGetterSetter() bool {
return strings.HasPrefix(m.Name, "set") || strings.HasPrefix(m.Name, "get")
}
type JMethodInfo struct {
Name string
Type string
Parameters []JParameter
Length string
}