View Javadoc

1   package com.lexicalscope.fluentreflection;
2   
3   
4   /*
5    * Copyright 2011 Tim Wood
6    *
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   *
11   * http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  /**
21   * Reflection information about a Object (an instance of a class).
22   *
23   * @author tim
24   *
25   * @param <T> the underlying type being reflected on
26   */
27  public interface FluentObject<T> extends FluentAccess<T> {
28      /**
29       * get the static reflection information about the type of this object
30       *
31       * @return the static reflection information about the type of this object
32       */
33      FluentClass<T> reflectedClass();
34  
35      /**
36       * The value under reflection
37       *
38       * @return the value that is being reflected upon
39       */
40      T value();
41  
42      /**
43       * The value under reflection cast to a given type
44       *
45       * @param asType the type the value should have been cast to
46       *
47       * @return the value that is being reflected upon
48       */
49      <V> V as(Class<V> asType);
50  }