Callable.java revision fead9ca09b117136b35bc5bf137340a754f9eddd
1/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package android.databinding.tool.reflection;
17
18public class Callable {
19
20    public static enum Type {
21        METHOD,
22        FIELD
23    }
24
25    public final Type type;
26
27    public final String name;
28
29    public final ModelClass resolvedType;
30
31    public final boolean isDynamic;
32
33    public final boolean canBeInvalidated;
34
35    public Callable(Type type, String name, ModelClass resolvedType, boolean isDynamic,
36            boolean canBeInvalidated) {
37        this.type = type;
38        this.name = name;
39        this.resolvedType = resolvedType;
40        this.isDynamic = isDynamic;
41        this.canBeInvalidated = canBeInvalidated;
42    }
43
44    public String getTypeCodeName() {
45        return resolvedType.toJavaCode();
46    }
47
48    @Override
49    public String toString() {
50        return "Callable{" +
51                "type=" + type +
52                ", name='" + name + '\'' +
53                ", resolvedType=" + resolvedType +
54                ", isDynamic=" + isDynamic +
55                ", canBeInvalidated=" + canBeInvalidated +
56                '}';
57    }
58}
59