private static <E extends FType>boolean isUserDefinedType(FTypeRef typeRef,Class<E> clazz){
  if (typeRef == null)   return false;
  FType type=getActualDerived(typeRef);
  if (type != null) {
    if (clazz.isInstance(type)) {
      return true;
    }
  }
  return false;
}

private static < E extends FType > boolean isUserDefinedType ( FTypeRef typeRef , Class < E > clazz ) { if ( typeRef == null ) return false ; FType type = getActualDerived ( typeRef ) ; if ( type != null ) { if ( clazz . isInstance ( type ) ) { return true ; } } return false ; }
returns true if the referenced type is a given user - defined type . this function handles typedefs correctly .
