Applescript Custom Class/Object?

Hi all,
I’m just learning Java and I’m wondering if there’s a way to make custom classes in AS like the ones in Java. For example, in Java I could make an object that had its own properties and a handful of methods I could use on it that I could define. The thing is, I’d much rather use Applescript because I know so much more about how it works. So, is it possible, or should I just attempt writing everything in Java?

Why not C/Objective-C? I mean, if you’re already using Java, Obj-C is a snap.

Here is an admittedly simple example, which offers some parallels to what you might want. I’m sure you can do much more, but I’m not really experienced in these waters.

on createSimpleNumber(initValue)
	script SimpleNumber
		property value : null
		
		on getValue()
			return value
		end getValue
		
		on setValue(n)
			set value to n
		end setValue
		
		on increment()
			set value to value + 1
		end increment
		
		on copyMultipliedBy(n)
			copy me to aCopy
			tell aCopy
				setValue(getValue() * n)
			end tell
			return aCopy
		end copyMultipliedBy
		
		on getStringValue()
			return value as string
		end getStringValue
	end script
	
	tell SimpleNumber
		setValue(initValue)
	end tell
	
	return SimpleNumber
end createSimpleNumber

set aNumber to createSimpleNumber(1.5)
tell aNumber
	increment()
	set anotherNumber to copyMultipliedBy(2)
end tell

return {aNumber's getStringValue(), getStringValue() of anotherNumber}
--> {"2.5", "5.0"}

See also: Script Objects

Thanks for the example, I can modify it to do exactly what I want. Thanks guys.