Hi All,
Thanks again, for support. Made many things more clear.
Thanks
Amit Kumar Verma
On Apr 22, 1:35 am, David Pollak
wrote:
> Amit,
> Class.forName(...) is called reflection in Scala/Java land. It allows you
> to get a class based on a String. You can then create a new instance of the
>
Amit,
Class.forName(...) is called reflection in Scala/Java land. It allows you
to get a class based on a String. You can then create a new instance of the
class with the newInstance() method. However, what you get is an instance
of Object... and you have to case it into something else before us
Hi Amit,
Try that one
def bindObject[T <: AnyRef](className: Class[T]): Option[Object] = {
val sClassName =
className.getPackage.getName.concat(".Wrap".concat(className.getSimpleName))
try {
Some(Class.forName(sClassName.replaceFirst("com.vtech",
"com.vtech.appxtension")).newInsta
Hi All,
This is a sample function for making an object from string at run
time. Here we are not casting the object but creating one. I wanted
the same thing for casting the object.
public static Object bindObject(Class className) {
Object objOutput = null;
try {
Strin
So your talking about reflection right? Take a look at scala Manifests
(which aide getting round type erasure) - other than that scala supports all
the normal reflection tooling that Java does.
Tim
On 18/04/2009 06:56, "Amit Kumar Verma" wrote:
> "Scala is a static language, so the class for
Amit,
There is no way that I know of in Java to construct a string at runtime and
use that string for casting. If you can show me an example of what you mean
in Java I'll show you the equivilent Scala code.
In terms of the roadmap, you started a thread on that. If you have
follow-up questions,
Hi David,
Sorry I used dynamic binding which was not correct.
But in the previous thread you said :
"Scala is a static language, so the class for casting must be known at
compile time. It's not possible to construct a String at runtime and
cast
an object into a class represented by that String.
On Fri, Apr 17, 2009 at 2:00 AM, Amit Kumar Verma wrote:
>
> Hi David,
>
> thanks, this is working fine. Problem is resolved.
>
> But dynamic binding is feature of java then why Scala don't support
> this.
I'm sorry, I don't understand what dynamic binding is. Scala supports
casting just like J
Hi David,
thanks, this is working fine. Problem is resolved.
But dynamic binding is feature of java then why Scala don't support
this.
This is an important feature.
Thanks again
Amit Kumar Verma
On Apr 13, 10:10 pm, David Pollak
wrote:
> I think it's best to use the built-in JSON creation cod
I think it's best to use the built-in JSON creation code and keep the code
as JsCmd as long as possible.
Here's a snippet that will place the JSON for all the Users in the page.
I'm including the whole project as well:
class HelloWorld {
def json: NodeSeq = Script(jsonForAll(User))
private d
Hi David,
Thanks for ur replies, I just want to make a generic function which
will take an object of mapper and returns the json string of the same.
I have written only two function
1. This will be called by ajax call :
def getJSONString(xhtml: Group):NodeSeq = {
getJSONStringGeneric
I think the .asJs method on all Mapper instances should give you the object
in JavaScript representation.
If you can post an entire file, I can work on helping you if the above
doesn't work.
On Thu, Apr 9, 2009 at 6:53 AM, Amit Kumar Verma wrote:
>
> copied the the same code but getting this erro
copied the the same code but getting this error
type arguments [_] do not conform to trait MetaMapper's type parameter
bounds [A <: net.liftweb.mapper.Mapper[A]] TravelMerchantTest/src/main/
scala/com/vtech/travelmerchant/snippet default.scala line 142
1239284830763 85593
Actually I am
Howdy,
Scala is a static language, so the class for casting must be known at
compile time. It's not possible to construct a String at runtime and cast
an object into a class represented by that String.
However, casting to a known class is easy in Scala... and it's done
primarily using pattern mat
14 matches
Mail list logo