Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: Extending standard java classes

"Andrew Eisenberg" <andrew@xxxxxxxxxxxx> writes:

Hi Andrew,

> In general, weaving the JDK is a difficult and risky process because
> of the memory required to do it and because once it's woven anyone who
> wants to run your program must run with the woven JDK.

I've thought that.  But with the command line ajc it works in a
reasonable time and resources.  (I can't tell if it acually works,
though, but at least it compiles. ;-))

> So, if t all possible, I'd try to avoid it.  Without knowing what you
> are trying to do it's hard to say how, but perhaps you can think of
> advising method calls to the classes in java.lang and java.util.

Not really, I think.

This is our situation: We have a query language which is an expression
language in the sense that for each type in the languages syntax graph
there's a corresponding evaluator which calculates its result and
returns it as JValue.

A JValue encapsulates a value of any type we support (Integer, Long,
Double, String, List, Map, Bag,...).  Basically it's something like

           class JValue { JValueType type, Object value }

where JValueType is an enumeration of all supported types and value is
the value, which can be casted to the correct type with a toType()
method.

Now when you work with that it can get quite cumbersome and I see that
we reimplement things which are given when using the encapsulated value
directly, for example that Integer, Long, Double are all Numbers.

So I thought it might be a better solution to define an interface AValue
that provides the methods we need and let all supported types implement
it.  So for example Integer, Double, ArrayList,... would be AValues.

Bye,
Tassilo



Back to the top