Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
FluentMember |
|
| 1.0;1 |
1 | package com.lexicalscope.fluentreflection; | |
2 | ||
3 | import java.lang.reflect.Member; | |
4 | import java.util.List; | |
5 | ||
6 | /** | |
7 | * Reflection information about a class member, such as a field or method. | |
8 | * | |
9 | * @author tim | |
10 | */ | |
11 | public interface FluentMember extends FluentAnnotated { | |
12 | /** | |
13 | * Type that declares the member | |
14 | * | |
15 | * @return type that declares the member | |
16 | */ | |
17 | FluentClass<?> declarer(); | |
18 | ||
19 | /** | |
20 | * The underlying member (class, field, constructor) | |
21 | * | |
22 | * @return the underlying member | |
23 | */ | |
24 | Member member(); | |
25 | ||
26 | /** | |
27 | * The name of the member. Constructors are called <init> | |
28 | * | |
29 | * @return the name of the member | |
30 | */ | |
31 | String name(); | |
32 | ||
33 | /** | |
34 | * The name of the member as a property name. Bean-style prefixes will be stripped from the member name. | |
35 | * | |
36 | * @return the name of the member as a property | |
37 | */ | |
38 | String property(); | |
39 | ||
40 | /** | |
41 | * The number of arguments that the member takes when called | |
42 | * | |
43 | * @return the number of arguments that the member takes when called | |
44 | */ | |
45 | int argCount(); | |
46 | ||
47 | /** | |
48 | * The types of the arguments used when the member is called | |
49 | * | |
50 | * @return the types of the arguments used when the member is called | |
51 | */ | |
52 | List<FluentClass<?>> args(); | |
53 | ||
54 | /** | |
55 | * The type of the member (the type of the field, or the return type of the method) | |
56 | * | |
57 | * @return the type of the member | |
58 | */ | |
59 | FluentClass<?> type(); | |
60 | ||
61 | /** | |
62 | * Call the member using the given arguments | |
63 | * | |
64 | * @param args the arguments to use in the call | |
65 | * | |
66 | * @return the value returned by the call | |
67 | */ | |
68 | Object callRaw(Object... args); | |
69 | ||
70 | /** | |
71 | * Call the member using the given arguments | |
72 | * | |
73 | * @param args the arguments to use in the call | |
74 | * | |
75 | * @return the value returned by the call wrapped in a fluent reflection wrapper | |
76 | */ | |
77 | FluentObject<?> call(Object... args); | |
78 | ||
79 | /** | |
80 | * Used to cast the result of a call on this member | |
81 | * | |
82 | * @param returnType the type expected as the result of the call | |
83 | * | |
84 | * @return object that can offers the call with the result cast to the given type | |
85 | */ | |
86 | <T> FluentCall<T> as(Class<T> returnType); | |
87 | ||
88 | /** | |
89 | * true iff the member is static | |
90 | * | |
91 | * @return true iff the member is static | |
92 | */ | |
93 | boolean isStatic(); | |
94 | ||
95 | /** | |
96 | * true iff the member is final | |
97 | * | |
98 | * @return true iff the member is final | |
99 | */ | |
100 | boolean isFinal(); | |
101 | ||
102 | /** | |
103 | * the visibility of the member | |
104 | * | |
105 | * @return the visibility of the member | |
106 | */ | |
107 | Visibility visibility(); | |
108 | } |