- Added documentation to some classes

- Created script provider system
- Did some refactoring to improve the API
This commit is contained in:
Stan Hebben committed 2014-06-10 21:12:55 +02:00
1 parent 38b78ce305
commit 97c7f42400
50 files changed
+1311 -318

No files matched your search

@@ -1,17 +1,11 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
/**
*
* @author Stanneke
* Used to indicate comparison types.
*
* @author Stan Hebben
*/
public enum CompareType {
FULL,
LT,
GT,
EQ,
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -12,9 +6,10 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Indicates a simple iterable. Should implement the iterable interface.
* Indicates a simple iterable. Annotated class must implement the iterable
* interface.
*
* @author Stanneke
* @author Stan Hebben
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -12,8 +6,9 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author Stanneke
* Indicates that the given method parameter cannot be null.
*
* @author Stan Hebben
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
@@ -1,14 +1,9 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
/**
*
* @author Stanneke
* Enum used to indicate operator type.
*
* @author Stan Hebben
*/
public enum OperatorType {
ADD,
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -15,9 +9,13 @@ import java.lang.annotation.Target;
* Denotes a caster. Casters are capable of converting one type into another.
* They implement the 'as' operator.
*
* For a native class, no arguments are provided. For an expansion method, the
* argument is the source value.
*
* @author Stan Hebben
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ZenCaster {
}
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -20,5 +14,11 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface ZenClass {
/**
* Contains the class' package and name. If omitted, the java package and
* name will be used.
*
* @return
*/
String value() default "";
}
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -12,11 +6,29 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author Stanneke
* Indicates that the given class contains an expansion for a certain type.
* The expansions themselves are given through annotated static methods.
*
* @author Stan Hebben
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface ZenExpansion {
/**
* Contains the type of the annotated class. May be any kind of ZenScript type.
*
* Examples:
* <ul>
* <li>int</li>
* <li>my.package.MyClass</li>
* <li>my.package.MyClass[]</li>
* <li>any</li>
* <li>any[]</li>
* <li>any[any]</li>
* </li>
* </ul>
*
* @return expanded type
*/
public String value();
}
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -15,10 +9,18 @@ import java.lang.annotation.Target;
* Indicates a getter. Will make the given method accessible as getter, that is,
* it's called when value.name is being used.
*
* For a native class, no arguments are provided. For an expansion, a single
* argument with the source value is provided.
*
* @author Stan Hebben
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ZenGetter {
/**
* Getter name. If omitted, the method name will be used as value name.
*
* @return getter name
*/
String value() default "";
}
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -12,8 +6,15 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author Stan
* Indicates a member getter. A member getter is a special kind of operator which
* is a fallback if a member could not be resolved. Can be used to make contents
* available as if they were members.
*
* If this method is a native class, it accepts a single string parameter with
* the member name. If this method is an expansion method, it accepts the source
* value and the member name.
*
* @author Stan Hebben
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -12,8 +6,15 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author Stan
* Used to indicate a member setter. Companion to member getters, but allow
* setting contents of this object as if they were members.
*
* If this method is a native class, it accepts a string parameter with
* the member name and a second parameter with the value. If this method is an
* expansion method, it accepts the source value, the member name and the value
* to be assigned.
*
* @author Stan Hebben
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -12,11 +6,21 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author Stanneke
* Used to indicate an exposed method.
*
* If this method is part of a native class, it will simply accept the parameters
* as provided. If it is part of an expansion method, it will also accept the
* instance value as first parameter.
*
* @author Stan Hebben
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ZenMethod {
/**
* Method name. If omitted, the original method name will be used.
*
* @return method name
*/
public String value() default "";
}
@@ -12,11 +12,18 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author Stanneke
* Used to indicate static methods for expansions. For native classes, use ZenMethod
* instead on a static method.
*
* @author Stan Hebben
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ZenMethodStatic {
/**
* Method name. If omitted, the annotated method name will be used.
*
* @return method name
*/
public String value() default "";
}
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -12,11 +6,17 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author Stanneke
* Used to indicate an operator. The arguments depend on the kind of operator.
*
* @author Stan Hebben
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ZenOperator {
/**
* Operator type for this operator.
*
* @return operator type
*/
OperatorType value();
}
@@ -1,9 +1,3 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package stanhebben.zenscript.annotations;
import java.lang.annotation.ElementType;
@@ -12,11 +6,21 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author Stanneke
* Used to annotate setters. Will make the given method accessible as setter, that is,
* it's called when value.name is being assinged a value.
*
* For a native class, a single argument with the assinged value is provided.
* For an expansion, the target object and assigned value are provided.
*
* @author Stan Hebben
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ZenSetter {
/**
* Setter name. If omitted, the method name is used as property name.
*
* @return setter name
*/
String value() default "";
}