velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark D. Anderson" <...@discerning.com>
Subject Re: summary table of velocity reflection?
Date Fri, 09 Aug 2002 19:41:32 GMT
I'm still hoping someone who actually knows the answer would give one, but
here is a revised attempt at summarizing this.

anything not public:
   not available
   workaround: add a public method to the class or a helper class

public static variables:
   java:  context.put("foobar", new org.apache.velocity.app.FieldMethodizer( "com.whatever.MyClass"
));
   VTL:   $foobar.SOME_CONSTANT

public instance variables:
   not available
   workaround: add a public method to the class

public constructors, no args:
   java:  context.put("ClassName", com.whatever.MyClass.class)
   VTL:   #set ($myobj = $ClassName.newInstance())

public constructors, with args:
   not available
   workaround: add a public static method to the class or a helper class

public static methods:
   java:  context.put("ClassName", com.whatever.MyClass.class)
   VTL:   $ClassName.doSomething()

public instance methods not starting with "get" or "set":
   java:  MyClass obj; context.put("myobj", obj);
   VTL:   $myobj.doSomething()

public instance methods starting with "get" or "set":
   java:  MyClass obj; context.put("myobj", obj);
   VTL:   $myobj.getBar()
          $myobj.setBar(1)
          $myobj.bar
          $myobj.Bar



--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message