Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/TypeSystem.java @ 18845:f57d86eb036f
removed Node factory methods
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 12 Jan 2015 20:39:04 +0100 |
parents | 288c23143d47 |
children | 1cde96b96673 |
comparison
equal
deleted
inserted
replaced
18843:f2261069ba99 | 18845:f57d86eb036f |
---|---|
35 * a single {@link Node} hierarchy. A {@link TypeSystem} defines a list of types as its child | 35 * a single {@link Node} hierarchy. A {@link TypeSystem} defines a list of types as its child |
36 * elements, in which every type precedes its super types.The latter condition ensures that the most | 36 * elements, in which every type precedes its super types.The latter condition ensures that the most |
37 * concrete type is found first when searching the list sequentially for the type of a given generic | 37 * concrete type is found first when searching the list sequentially for the type of a given generic |
38 * value. | 38 * value. |
39 * </p> | 39 * </p> |
40 * | 40 * |
41 * <p> | 41 * <p> |
42 * Each {@link #value()} is represented as a java type. A type can specify two annotations: | 42 * Each {@link #value()} is represented as a java type. A type can specify two annotations: |
43 * {@link TypeCheck} and {@link TypeCast}. The {@link TypeCheck} checks whether a given generic | 43 * {@link TypeCheck} and {@link TypeCast}. The {@link TypeCheck} checks whether a given generic |
44 * value matches to the current type. The {@link TypeCast} casts a generic type value to the current | 44 * value matches to the current type. The {@link TypeCast} casts a generic type value to the current |
45 * type. If the {@link TypeCheck} and {@link TypeCast} annotations are not declared in the | 45 * type. If the {@link TypeCheck} and {@link TypeCast} annotations are not declared in the |
49 * used to extend the definition of a type in the language. In our example, the | 49 * used to extend the definition of a type in the language. In our example, the |
50 * <code>isInteger</code> and <code>asInteger</code> methods are defined in a way so that they | 50 * <code>isInteger</code> and <code>asInteger</code> methods are defined in a way so that they |
51 * accept also {@link Integer} values, implicitly converting them to {@link Double} . This example | 51 * accept also {@link Integer} values, implicitly converting them to {@link Double} . This example |
52 * points out how we express implicit type conversions. | 52 * points out how we express implicit type conversions. |
53 * </p> | 53 * </p> |
54 * | 54 * |
55 * <p> | 55 * <p> |
56 * <b>Example:</b> The {@link TypeSystem} contains the types {@link Boolean}, {@link Integer}, and | 56 * <b>Example:</b> The {@link TypeSystem} contains the types {@link Boolean}, {@link Integer}, and |
57 * {@link Double}. The type {@link Object} is always used implicitly as the generic type represent | 57 * {@link Double}. The type {@link Object} is always used implicitly as the generic type represent |
58 * all values. | 58 * all values. |
59 * | 59 * |
60 * <pre> | 60 * <pre> |
61 * | 61 * |
62 * {@literal @}TypeSystem(types = {boolean.class, int.class, double.class}) | 62 * {@literal @}TypeSystem(types = {boolean.class, int.class, double.class}) |
63 * public abstract class ExampleTypeSystem { | 63 * public abstract class ExampleTypeSystem { |
64 * | 64 * |
65 * {@literal @}TypeCheck | 65 * {@literal @}TypeCheck |
66 * public boolean isInteger(Object value) { | 66 * public boolean isInteger(Object value) { |
71 * public double asInteger(Object value) { | 71 * public double asInteger(Object value) { |
72 * return ((Number)value).doubleValue(); | 72 * return ((Number)value).doubleValue(); |
73 * } | 73 * } |
74 * } | 74 * } |
75 * </pre> | 75 * </pre> |
76 * | 76 * |
77 * | 77 * |
78 * @see TypeCast | 78 * @see TypeCast |
79 * @see TypeCheck | 79 * @see TypeCheck |
80 */ | 80 */ |
81 @Retention(RetentionPolicy.CLASS) | 81 @Retention(RetentionPolicy.CLASS) |
82 @Target({ElementType.TYPE}) | 82 @Target({ElementType.TYPE}) |