Package org.javarosa.core.reference
Class RootTranslator
java.lang.Object
org.javarosa.core.reference.RootTranslator
- All Implemented Interfaces:
ReferenceFactory,Externalizable
public class RootTranslator extends Object implements ReferenceFactory, Externalizable
A Root Translator is a simple reference factory which doesn't
actually derive any specific references, but rather translates
references from one prefix to another. This is useful for roots
which don't describe any real raw accessor like "jr://media/",
which could access a file reference (jr://file/) on one platform,
but a resource reference (jr://resource/) on another.
Root Translators can be externalized and used as a dynamically
configured object.
- Author:
- ctsims
-
Field Summary
Fields Modifier and Type Field Description StringprefixStringtranslatedPrefix -
Constructor Summary
Constructors Constructor Description RootTranslator()Serialization only!RootTranslator(String prefix, String translatedPrefix)Creates a translator which will create references of the type described by translatedPrefix whenever references of the type prefix are being derived. -
Method Summary
Modifier and Type Method Description Referencederive(String URI)Referencederive(String URI, String context)booleanderives(String URI)voidreadExternal(DataInputStream in, PrototypeFactory pf)StringtoString()voidwriteExternal(DataOutputStream out)
-
Field Details
-
Constructor Details
-
RootTranslator
public RootTranslator()Serialization only! -
RootTranslator
Creates a translator which will create references of the type described by translatedPrefix whenever references of the type prefix are being derived.
-
-
Method Details
-
derive
- Specified by:
derivein interfaceReferenceFactory- Throws:
InvalidReferenceException
-
derive
- Specified by:
derivein interfaceReferenceFactory- Throws:
InvalidReferenceException
-
derives
- Specified by:
derivesin interfaceReferenceFactory
-
readExternal
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionDeserializationException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
toString
-