Add javadoc to Load explaining escaping scheme used (JENA-507)

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/f1feb70f
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/f1feb70f
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/f1feb70f

Branch: refs/heads/JENA-507
Commit: f1feb70f88cfcb40bfc863c568d8ba4496fff314
Parents: 50de126
Author: Rob Vesse <[email protected]>
Authored: Thu Oct 9 15:32:44 2014 +0100
Committer: Rob Vesse <[email protected]>
Committed: Thu Oct 9 15:32:44 2014 +0100

----------------------------------------------------------------------
 .../com/hp/hpl/jena/sparql/util/Loader.java     | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/f1feb70f/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/Loader.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/Loader.java 
b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/Loader.java
index 3a74ea5..7ee412e 100644
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/Loader.java
+++ b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/Loader.java
@@ -23,6 +23,32 @@ import org.apache.jena.atlas.logging.Log;
 import com.hp.hpl.jena.sparql.ARQConstants;
 import com.hp.hpl.jena.sparql.ARQInternalErrorException;
 
+/**
+ * Helper for loading class instances
+ * <p>
+ * This is primarily used as a helper by {@link MappedLoader} to dynamically
+ * load in functions without a need to pre-register them. Since these class
+ * names originate from URIs which may contain characters which are not valid 
in
+ * Java class names this class implements a simple escaping scheme.
+ * </p>
+ * <h3>Escaping Scheme</h3>
+ * <p>
+ * Escaping is applied only to the last portion of the class name, typically
+ * {@link MappedLoader} takes care of mapping a function library namespace
+ * prefix into a java package name and likely only the last portion (the
+ * function name) will require escaping.
+ * </p>
+ * <p>
+ * If the first character of the class name is invalid it is replaced with
+ * {@code F_}. If any subsequent characters are invalid they are ignored and 
the
+ * subsequent valid character (if any) is promoted to upper case giving a camel
+ * case style valid class name.
+ * </p>
+ * <p>
+ * For example if the last portion of the class name were {@code foo-bar-faz}
+ * then we would end up with an escaped class name of {@code fooBarFaz}.
+ * </p>
+ */
 public class Loader {
     static public Class<?> loadClass(String classNameOrURI) {
         return loadClass(classNameOrURI, null);

Reply via email to