private TypeName getExpressionReturnTypeForAttribute ( Attribute attribute , Map < String , Class < ? > > propertiesTypes ) { String attributeName = attribute . getKey ( ) . toLowerCase ( ) ; if ( attributeName . indexOf ( "@" ) == 0 || attributeName . indexOf ( "v-on:" ) == 0 ) { return TypeName . VOID ; } if ( "v-if" . equals ( attributeName ) || "v-show" . equals ( attributeName ) ) { return TypeName . BOOLEAN ; } if ( isBoundedAttribute ( attributeName ) ) { String unboundedAttributeName = boundedAttributeToAttributeName ( attributeName ) ; if ( unboundedAttributeName . equals ( "class" ) || unboundedAttributeName . equals ( "style" ) ) { return TypeName . get ( Any . class ) ; } if ( propertiesTypes . containsKey ( unboundedAttributeName ) ) { return TypeName . get ( propertiesTypes . get ( unboundedAttributeName ) ) ; } } if ( currentProp != null ) { return currentProp . getType ( ) ; } return TypeName . get ( Any . class ) ; }
Guess the type of the expression based on where it is used . The guessed type can be overridden by adding a Cast to the desired type at the beginning of the expression .