My thought
is that there’s more to it
than just getJavaType(). Things like knowing if it’s an Enum, a
primitive, a primitive wrapper, an array, generics. And for the simple
cases, what does getJavaType() return, a String name, a fully qualified
name, a
jdt IType? But yes, you’re right that we’ll need the same
thing for XML so it makes sense to put this api on
PersistentAttribute. So,
if someone feels they can take this on in this iteration…
Karen
I'm not sure why this would be
difficult to put on
PersistentAttribute.... ?
Maybe not:
persistentAttribute.getAttribute()
which seems to be a very java-ish thing, but certainly:
persistentAttribute.getJavaType()
or something like that would be possible, especially because even for
XML we'd
need it.
- Paul
Karen Moore wrote:
Hi Dirk,
We have code
for this, but currently
it’s in 2 separate places and not where you can use it. We either
duplicate that code in a 3rd place or we clean it up now for
you to
have access to it. You can get to the appropriate object by calling
PersistentAttribute.getModelAdapter(). Cast the
IPersistentAttributeModelAdapter to a
JavaPersistentAttributeModelAdapter and
call getAttribute(). From AbstractAttribute you can get a hold of the
JDT
IMember, IField, IMethod, or IType.
We have code
that does what you need in
JavaBasicModelAdapter.defaultApplies() and
JavaReferencePersistentAttributeFlavorModelAdapter.javaDefaultTargetEntity().
Now while I don’t want to advocate cut and paste, that might be the
simplest thing right now for completion of this iteration. Then we
need
to make this a new task for the next iteration to clean this up and put
the
code in a place that makes sense for use in all 3 locations. Anyone
else have
suggestions?
Karen
Hi All,
How do I get the type of an attribute (eg. int for: private int id; or
public
int getId();) starting from a PersistentAttribute (got it from
PersistentType.getPersistentAttributes())?
Dirk le Roux
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev