Re: [all] Expression API?

2008-04-09 Thread James Carman
On Sun, Apr 6, 2008 at 4:43 PM, Matt Benson [EMAIL PROTECTED] wrote:
  I'm still hoping to bring Morph on board soon, and its
  current codebase contains several facets including a
  Language abstraction.  I really think there's some
  overlap there with [el], but another piece of Morph is
  its Reflector APIs which are similar to BeanUtils'
  DynaBean, and I'm thinking the Reflector APIs could go
  far toward providing a useful abstraction to plug
  arbitrary object types into expression evaluators.


Matt,

I took a brief look at Morph and the Language interface.  I like the
idea, but I'm looking for something a bit more object-oriented (not
that Morph isn't, I'm just saying my idea goes 0.0001 percent more in
the OO direction :).  I'm looking to take the String parameter out of
the get/set method's API.  I want an object that represents a gettable
and (potentially) settable expression.  Would that be something that
goes into Morph?  The Wicket folks are looking for something somewhat
soon.  I was just wondering if this idea was something we could get
into one of our current projects (or if it even belongs there).
Perhaps I can start a sandbox project for my ideas.  What I have in
mind is implementations using such things as:

Javassist
MVEL
OGNL
JXPath
JSTL-EL

There would be implementations of Expression for each of those.  Also,
there would be builders that would allow you to use Java to build up
the expression which could be played back later.  So, you would do
something like:

builder.recorder().getAddress().getCity();
Expression e = builder.createExpression();

Somehow we could get this on one line, but the idea is similar to how
EasyMock (or JMock) works.  You perform operations on the proxied
recorder (proxy already has this built-in now) and it remembers what
you did.  Then you ask the recorder to build an Expression object
which allows you to replay what you just did at a later date on the
same type of root object (it would allow you to set that value also).

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[all] Expression API?

2008-04-06 Thread James Carman
The concept of an expression comes up within a lot of contexts.
There are various ways to define/evaluate an expression, currently,
but there's no standardized API way to deal with them.  I was trying
to come up with an API, but I don't know where it should belong.
Should it be part of Lang, BeanUtils, or its own project.  Here's the
basic idea:

public interface Expression
{
  public Object getValue(Object rootObject);
  public void setValue(Object rootObject, Object value);
}

This is similar to the way OGNL thinks of things except they compile
their expressions into some nebulous tree object (no API, just
represented as an Object) and you then use the static methods on the
Ognl class to get/set values using that tree.  The way I see it, this
interface could be implemented in a variety of ways (OGNL, MVEL,
JSTL-EL, reflection, Javassist, etc.).  So, what I'm looking for is a
home.  Where should something like this belong?  Does it even belong
in Commons at all, since it's a framework (it could be argued that
Proxy is a framework much like this too, though)?  Thoughts anyone?

This idea came up when discussing the concept of recording this
expression using proxied root objects (similar to how mock testing
frameworks do it).  I have the logic to record invoked methods using
Commons Proxy, but I need a way to generate expression objects that I
can then evaluate later.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [all] Expression API?

2008-04-06 Thread Matt Benson

--- James Carman [EMAIL PROTECTED] wrote:

 The concept of an expression comes up within a lot
 of contexts.
 There are various ways to define/evaluate an
 expression, currently,
 but there's no standardized API way to deal with
 them.  I was trying
 to come up with an API, but I don't know where it
 should belong.
 Should it be part of Lang, BeanUtils, or its own
 project.  Here's the
 basic idea:
 
 public interface Expression
 {
   public Object getValue(Object rootObject);
   public void setValue(Object rootObject, Object
 value);
 }
 
 This is similar to the way OGNL thinks of things
 except they compile
 their expressions into some nebulous tree object
 (no API, just
 represented as an Object) and you then use the
 static methods on the
 Ognl class to get/set values using that tree.  The
 way I see it, this
 interface could be implemented in a variety of ways
 (OGNL, MVEL,
 JSTL-EL, reflection, Javassist, etc.).  So, what I'm
 looking for is a
 home.  Where should something like this belong? 
 Does it even belong
 in Commons at all, since it's a framework (it
 could be argued that
 Proxy is a framework much like this too, though)? 
 Thoughts anyone?
 
 This idea came up when discussing the concept of
 recording this
 expression using proxied root objects (similar to
 how mock testing
 frameworks do it).  I have the logic to record
 invoked methods using
 Commons Proxy, but I need a way to generate
 expression objects that I
 can then evaluate later.
 

I'm still hoping to bring Morph on board soon, and its
current codebase contains several facets including a
Language abstraction.  I really think there's some
overlap there with [el], but another piece of Morph is
its Reflector APIs which are similar to BeanUtils'
DynaBean, and I'm thinking the Reflector APIs could go
far toward providing a useful abstraction to plug
arbitrary object types into expression evaluators.

-Matt


-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 



  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]