Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Modifiers | Name | Description |
---|---|---|
static class |
WideningCategories.LowestUpperBoundClassNode |
This ClassNode specialization is used when the lowest upper bound of two types cannot be represented by an existing type. |
Type | Name and description |
---|---|
static boolean |
implementsInterfaceOrSubclassOf(ClassNode source, ClassNode targetType) Determines if the source class implements an interface or subclasses the target type. |
static boolean |
isBigDecCategory(ClassNode type) It is of a BigDecimal category, if the provided type is a BigInteger category or a BigDecimal. |
static boolean |
isBigIntCategory(ClassNode type) It is of a BigInteger category, if the provided type is a long category or a BigInteger. |
static boolean |
isDouble(ClassNode type) Used to check if a type is an double or Double. |
static boolean |
isDoubleCategory(ClassNode type) It is of a double category, if the provided type is a BigDecimal, a float, double. |
static boolean |
isFloat(ClassNode type) Used to check if a type is a float or Float. |
static boolean |
isFloatingCategory(ClassNode type) It is of a floating category, if the provided type is a a float, double. |
static boolean |
isInt(ClassNode type) Used to check if a type is an int or Integer. |
static boolean |
isIntCategory(ClassNode type) It is of an int category, if the provided type is a byte, char, short, int. |
static boolean |
isLongCategory(ClassNode type) It is of a long category, if the provided type is a long, its wrapper or if it is a long category. |
static boolean |
isNumberCategory(ClassNode type) |
static ClassNode |
lowestUpperBound(List<ClassNode> nodes) Given a list of class nodes, returns the first common supertype. |
static ClassNode |
lowestUpperBound(ClassNode a, ClassNode b) Given two class nodes, returns the first common supertype, or the class itself if there are equal. |
Determines if the source class implements an interface or subclasses the target type. This method takes the org.codehaus.groovy.ast.tools.WideningCategories.LowestUpperBoundClassNode type into account, allowing to remove unnecessary casts.
source
- the type of interesttargetType
- the target type of interestIt is of a BigDecimal category, if the provided type is a BigInteger category or a BigDecimal.
It is of a BigInteger category, if the provided type is a long category or a BigInteger.
Used to check if a type is an double or Double.
type
- the type to checkIt is of a double category, if the provided type is a BigDecimal, a float, double. C(type)=double
Used to check if a type is a float or Float.
type
- the type to checkIt is of a floating category, if the provided type is a a float, double. C(type)=float
Used to check if a type is an int or Integer.
type
- the type to checkIt is of an int category, if the provided type is a byte, char, short, int.
It is of a long category, if the provided type is a long, its wrapper or if it is a long category.
Given a list of class nodes, returns the first common supertype. For example, Double and Float would return Number, while Set and String would return Object.
nodes
- the list of nodes for which to find the first common super type.Given two class nodes, returns the first common supertype, or the class itself if there are equal. For example, Double and Float would return Number, while Set and String would return Object. This method is not guaranteed to return a class node which corresponds to a real type. For example, if two types have more than one interface in common and are not in the same hierarchy branch, then the returned type will be a virtual type implementing all those interfaces. Calls to this method are supposed to be made with resolved generics. This means that you can have wildcards, but no placeholder.
a
- first class nodeb
- second class node