Skip to content

Commit 285d524

Browse files
committed
Added the initial CRE subclasses
This feature cannot be fully implemented until the deprecation period for the constructors of ConfigRuntimeException is over, and those constructors are removed.
1 parent 3285ec1 commit 285d524

32 files changed

+310
-19
lines changed
Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
21
package com.laytonsmith.core;
32

43
import com.laytonsmith.PureUtilities.Version;
54

65
/**
7-
* Elements implementing this provide simple documentation data
8-
* to the docgen, not complex data.
6+
* Elements implementing this provide simple documentation data to the docgen,
7+
* not complex data.
98
*/
109
public interface SimpleDocumentation {
1110
/**
12-
* The name of this code element
11+
* The name of this code element
12+
*
1313
* @return The name of this code element.
14-
*/
15-
String getName();
16-
17-
/**
18-
* Returns documentation in a format that is specified by the code type
19-
* @return
20-
*/
21-
String docs();
22-
23-
/**
24-
* Returns the version number of when this functionality was added. It should
25-
* follow the format 0.0.0
26-
* @return
27-
*/
28-
Version since();
14+
*/
15+
String getName();
16+
17+
/**
18+
* Returns documentation in a format that is specified by the code type
19+
*
20+
* @return
21+
*/
22+
String docs();
23+
24+
/**
25+
* Returns the version number of when this functionality was added. It
26+
* should follow the format 0.0.0
27+
*
28+
* @return
29+
*/
30+
Version since();
2931
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package com.laytonsmith.core.exceptions.CRE;
2+
3+
import com.laytonsmith.PureUtilities.ClassLoading.ClassDiscovery;
4+
import com.laytonsmith.annotations.seealso;
5+
import com.laytonsmith.annotations.typeof;
6+
import com.laytonsmith.core.Documentation;
7+
import com.laytonsmith.core.constructs.Target;
8+
import com.laytonsmith.core.exceptions.ConfigRuntimeException;
9+
import com.laytonsmith.core.functions.Exceptions;
10+
import com.laytonsmith.core.functions.Exceptions.ExceptionType;
11+
import java.net.URL;
12+
13+
/**
14+
* Exceptions should extend this class, which provides default implementations of various utility methods.
15+
*/
16+
public abstract class AbstractException extends ConfigRuntimeException implements Documentation {
17+
18+
// public AbstractException(String msg, Target t){
19+
// super(msg, tempGetExceptionType(), t);
20+
// }
21+
22+
private final static Class[] EMPTY_CLASS = new Class[0];
23+
24+
@Override
25+
public Class<? extends Documentation>[] seeAlso() {
26+
seealso see = this.getClass().getAnnotation(seealso.class);
27+
if(see == null){
28+
return EMPTY_CLASS;
29+
} else {
30+
return see.value();
31+
}
32+
}
33+
34+
@Override
35+
public URL getSourceJar() {
36+
return ClassDiscovery.GetClassContainer(this.getClass());
37+
}
38+
39+
@Override
40+
public String getName() {
41+
typeof to = this.getClass().getAnnotation(typeof.class);
42+
if(to == null){
43+
throw new Error("ConfigRuntimeException subtypes must annotate themselves with @typeof, if they are instantiateable.");
44+
} else {
45+
return to.value();
46+
}
47+
}
48+
49+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.laytonsmith.core.exceptions.CRE;
2+
3+
/**
4+
*
5+
*/
6+
public class CREBadEntityException {
7+
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.laytonsmith.core.exceptions.CRE;
2+
3+
/**
4+
*
5+
*/
6+
public class CREBadEntityTypeException {
7+
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.laytonsmith.core.exceptions.CRE;
2+
3+
/**
4+
*
5+
*/
6+
public class CREBindException {
7+
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.laytonsmith.core.exceptions.CRE;
2+
3+
/**
4+
*
5+
*/
6+
public class CRECastException {
7+
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.laytonsmith.core.exceptions.CRE;
2+
3+
/**
4+
*
5+
*/
6+
public class CREEnchantmentException {
7+
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.laytonsmith.core.exceptions.CRE;
2+
3+
/**
4+
*
5+
*/
6+
public class CREFormatException {
7+
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.laytonsmith.core.exceptions.CRE;
2+
3+
/**
4+
*
5+
*/
6+
public class CREIOException {
7+
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.laytonsmith.core.exceptions.CRE;
2+
3+
/**
4+
*
5+
*/
6+
public class CREIllegalArgumentException {
7+
8+
}

0 commit comments

Comments
 (0)