Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a meta-language available for Java that allows you to access object complex hierarchies?

Tags:

java

oop

I'm evaluating some potential implementations of a complex object hierarchy model for my current project. I'm wondering if there is an xpath-style meta-language or something like this that would allow me to query these object linkages.

Furthermore, I'm sure there is some very specific jargon used for the problem I am asking about - I just don't know it.

The requirements:

  • Must be done in Java (or at least compiled to Java bytecode).
  • Objects will be hierarchically related to each other with n possible links. obj1->obj2->obj3->...
  • We need to be able to look up any object in the hierarchy based on an objects properties or its relationship to other objects.
  • Objects will be of the same type.
  • Hierarchical lookups should be able to happen at runtime.

I think I could roll my own solution here, but I'm curious if someone smarter than me has already come up with something.

After seeing some answers come in, I think I might need to clarify my question a bit more. Specifically, this tool would be used to traverse a set of Objects that are different versions of a parent object.

For example:

[Object 1 prop1="foo" prop2="bar" prop3="zoop"]

↓ Inherits from above object ↓

[Object 2 prop1="foo and something" prop2="bar" prop3="zoop"]

↓ Inherits from above object ↓

[Object 3 prop1="foo and something" prop2="bar" prop3="zoop 24"]

like image 425
Elijah Avatar asked Jan 01 '26 06:01

Elijah


1 Answers

I believe JXPath should do what you want.

like image 189
Brian Kent Avatar answered Jan 03 '26 20:01

Brian Kent



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!