在ColdFusion中创建嵌套Java类的实例

时间:2022-04-18 22:29:04

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

我正在尝试在ColdFusion中创建一个java.awt.geom.Point2D.Double实例。

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

Point2D.Double是抽象类Point2D中的嵌套类。我试图使用以下方法实例化该类:

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

This fails because ColdFusion cannot find the class.

这会失败,因为ColdFusion无法找到该类。

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).

并且 这不起作用,因为Point2D是一个抽象类,并且没有可以调用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.

现在,我已经使用自己的Point类来包装Point2D.Double类,以便我可以在ColdFusion中实例化它。我不认为这是理想的,我正在寻找有关如何在ColdFusion中直接创建Point2D.Double类的想法。

I'm also using ColdFusion 8.

我也在使用ColdFusion 8。

1 个解决方案

#1


13  

Try with:

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

For nested classes, use $

对于嵌套类,请使用$

#1


13  

Try with:

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

For nested classes, use $

对于嵌套类,请使用$