473,386 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Reflection and used classes

Hi Folks,

Is there any way of using reflection to find out what classes other
classes use?

I do not mean which classes extend other classes, I mean within methods,
for example, where the "new" keyword instantiates objects of other classes.

Any ideas?
Jun 2 '08 #1
3 1081
Hi,

Don't know of a way to this with reflection.

You can use PHPXref to locate references to a particular class, or you
could try a recursive grep for a class identifier.

Regards,

John Peters

On Apr 25, 2:37 pm, Hugh Oxford <ares...@fas.comwrote:
Hi Folks,

Is there any way of using reflection to find out what classes other
classes use?

I do not mean which classes extend other classes, I mean within methods,
for example, where the "new" keyword instantiates objects of other classes.

Any ideas?
Jun 2 '08 #2
petersprc wrote:
Hi,

Don't know of a way to this with reflection.

You can use PHPXref to locate references to a particular class, or you
could try a recursive grep for a class identifier.

Regards,

John Peters
I like PHPxref, the problem is I use autoload. Maybe I could look at the
code.

Jun 2 '08 #3
Hugh Oxford wrote:
Is there any way of using reflection to find out what classes other
classes use?

I do not mean which classes extend other classes, I mean within methods,
for example, where the "new" keyword instantiates objects of other classes.

Any ideas?
Sorry, but in languages like PHP here is no way to do such things
reliably. This is real code from my current project:

<CODE>
....
$classname=self::getClassName($classId);
$filename=strtolower($classId.'.object.php');

include_once $filename;

$object= new $classname($this,$parentId,$name);
....
</CODE>

Class names taken from XML file. So if you have case like this and
PHPxref is not enough for you - I think here are tools to do this as you
want.
Jun 2 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Frazer | last post by:
hi could any one tell me which real life senarios reflection can be used in ? thnx
10
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a...
6
by: MrNobody | last post by:
How would you handle this situation: I have a series of classes which are to be later loaded using reflection: but the class to be used can vary depending on strings from a text file. So this...
11
by: Aaron Queenan | last post by:
Given the classes: class Class { public static implicit operator int(Class c) { return 0; } } class Holder
15
by: Jeff Mason | last post by:
Hi, I'm having a reflection brain fog here, perhaps someone can set me on the right track. I'd like to define a custom attribute to be used in a class hierarchy. What I want to do is to...
5
by: heddy | last post by:
I understand that reflection allows me to discover the metadata of a class at runtime (properties, methods etc). What I don't understand is where this is useful. For example: If I am the sole...
7
by: BK | last post by:
I've used reflection quite a bit to launch forms, it works great, requires little coding, and allows me to launch forms from a dynamic menu. Now I have a need to instantiate any one of several...
5
by: DesCF | last post by:
What exactly is Reflection ? I've looked at the definition in Help but I don't find it very helpful! I just stare at it blankly and can't quite seem to grasp its meaning conceptually. Reflection...
6
by: Cralis | last post by:
Hi guys, Someone once said, 'You can do that with reflection'. I can't recall what it was I was trying to do at the time, but then he said, 'Any developer knows what reflection is...'. I kept...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.