Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating an instance of a nested Java class in ColdFusion

I’m trying to create an instance of: java.awt.geom.Point2D.Double in ColdFusion.

Point2D.Double is a nested class inside of the abstract class Point2D. I have tried to instantiate the class using:

<cfset PointClass = createObject("java", "java.awt.geom.Point2D.Double")>

This fails because ColdFusion cannot find the class.

And <cfset PointClass = createObject("java", "java.awt.geom.Point2D")> which does not work because Point2D is an abstract class and there is not a public constructor on which you can call PointClass.init(x,y).

Right now, I’ve resorted to making my own Point class that wraps the Point2D.Double class so that I can instantiate it in ColdFusion. I don’t think this is ideal and am looking for ideas about how to directly create a Point2D.Double class in ColdFusion.

I'm also using ColdFusion 8.

like image 970
Bialecki Avatar asked Dec 10 '22 23:12

Bialecki


1 Answers

Try with:

<cfset PointClass = createObject("java", "java.awt.geom.Point2D$Double")>

For nested classes, use $

like image 124
asterite Avatar answered Feb 23 '23 01:02

asterite