/** * @param member The {@code Member} instance for which to retrieve the type. * * @return Returns the {@code Type} of the given {@code Field} or {@code Method}. * * @throws IllegalArgumentException in case {@code member} is not a {@code Field} or {@code Method}. */ public static Type typeOf(Member member) { Type type; if ( member instanceof Field ) { type = ( (Field) member ).getGenericType(); } else if ( member instanceof Method ) { type = ( (Method) member ).getGenericReturnType(); } else if ( member instanceof Constructor<?> ) { type = member.getDeclaringClass(); } //TODO HV-571 change log method name else { throw LOG.getMemberIsNeitherAFieldNorAMethodException( member ); } if ( type instanceof TypeVariable ) { type = TypeHelper.getErasedType( type ); } return type; }
/** * @param member The <code>Member</code> instance for which to retrieve the type. * * @return Returns the <code>Type</code> of the given <code>Field</code> or <code>Method</code>. * * @throws IllegalArgumentException in case <code>member</code> is not a <code>Field</code> or <code>Method</code>. */ public static Type typeOf(Member member) { Type type; if ( member instanceof Field ) { type = ( (Field) member ).getGenericType(); } else if ( member instanceof Method ) { type = ( (Method) member ).getGenericReturnType(); } else if ( member instanceof Constructor<?> ) { type = member.getDeclaringClass(); } //TODO HV-571 change log method name else { throw log.getMemberIsNeitherAFieldNorAMethodException( member ); } if ( type instanceof TypeVariable ) { type = TypeHelper.getErasedType( type ); } return type; }