Package org.apache.cxf.javascript
Class JavascriptUtils
java.lang.Object
org.apache.cxf.javascript.JavascriptUtils
A set of functions that assist in JavaScript generation. This includes
functions for appending strings of JavaScript to a buffer as well as some
type utilities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidappendExpression(String value) voidappendLine(String line) voidappendString(String value) emit javascript to append a value to the accumulator.voidendBlock()escapeStringQuotes(String data) voidgenerateCodeToSerializeAny(ParticleInfo itemInfo, String prefix, SchemaCollection schemaCollection) Generate code to serialize an xs:any.voidgenerateCodeToSerializeElement(ParticleInfo elementInfo, String referencePrefix, SchemaCollection schemaCollection) Given an element, generate the serialization code.static org.apache.ws.commons.schema.XmlSchemaAllgetAll(org.apache.ws.commons.schema.XmlSchemaComplexType type) static org.apache.ws.commons.schema.XmlSchemaChoicegetChoice(org.apache.ws.commons.schema.XmlSchemaComplexType type) static List<org.apache.ws.commons.schema.XmlSchemaObject>getContentElements(org.apache.ws.commons.schema.XmlSchemaComplexType type, SchemaCollection collection) static org.apache.ws.commons.schema.XmlSchemaSequencegetContentSequence(org.apache.ws.commons.schema.XmlSchemaComplexType type) getDefaultValueForSimpleType(org.apache.ws.commons.schema.XmlSchemaType type) static org.apache.ws.commons.schema.XmlSchemaAnnotatedgetObjectAnnotated(org.apache.ws.commons.schema.XmlSchemaObject object, QName contextName) If the object is an attribute or an anyAttribute, return the 'Annotated'.static org.apache.ws.commons.schema.XmlSchemaParticlegetObjectParticle(org.apache.ws.commons.schema.XmlSchemaObject object, QName contextName, org.apache.ws.commons.schema.XmlSchema currentSchema) If the object is an element or an any, return the particle.static org.apache.ws.commons.schema.XmlSchemaSequencegetSequence(org.apache.ws.commons.schema.XmlSchemaComplexType type) booleanisStringSimpleType(QName typeName) static StringjavaScriptNameToken(String token) javascriptParseExpression(org.apache.ws.commons.schema.XmlSchemaType type, String value) static booleanmtomCandidateType(org.apache.ws.commons.schema.XmlSchemaType type) Return true for xsd:base64Binary or simple restrictions of it, as in the xmime stock type.static booleannotVeryComplexType(org.apache.ws.commons.schema.XmlSchemaType type) We don't want to generate Javascript overhead for complex types with simple content models, at least until or unless we decide to cope with attributes in a general way.static StringprotectSingleQuotes(String value) voidsetXmlStringAccumulator(String variableName) voidvoidstartDo()voidvoidstartForIn(String var, String collection) voidvoidstartWhile(String test) voidstartXmlStringAccumulator(String variableName)
-
Constructor Details
-
JavascriptUtils
-
-
Method Details
-
getDefaultValueForSimpleType
-
isStringSimpleType
-
setXmlStringAccumulator
-
startXmlStringAccumulator
-
protectSingleQuotes
-
escapeStringQuotes
-
appendString
emit javascript to append a value to the accumulator.- Parameters:
value-
-
appendExpression
-
appendLine
-
startIf
-
startBlock
public void startBlock() -
appendElse
public void appendElse() -
endBlock
public void endBlock() -
startFor
-
startForIn
-
startWhile
-
startDo
public void startDo() -
javascriptParseExpression
-
javaScriptNameToken
-
notVeryComplexType
public static boolean notVeryComplexType(org.apache.ws.commons.schema.XmlSchemaType type) We don't want to generate Javascript overhead for complex types with simple content models, at least until or unless we decide to cope with attributes in a general way.- Parameters:
type-- Returns:
-
mtomCandidateType
public static boolean mtomCandidateType(org.apache.ws.commons.schema.XmlSchemaType type) Return true for xsd:base64Binary or simple restrictions of it, as in the xmime stock type.- Parameters:
type-- Returns:
-
generateCodeToSerializeElement
public void generateCodeToSerializeElement(ParticleInfo elementInfo, String referencePrefix, SchemaCollection schemaCollection) Given an element, generate the serialization code.- Parameters:
elementInfo- description of the element we are serializingreferencePrefix- prefix to the Javascript variable. Nothing for args, this._ for members.schemaCollection- caller's schema collection.
-
generateCodeToSerializeAny
public void generateCodeToSerializeAny(ParticleInfo itemInfo, String prefix, SchemaCollection schemaCollection) Generate code to serialize an xs:any. There is too much duplicate code with the element serializer; fix that some day.- Parameters:
itemInfo-prefix-schemaCollection-
-
getObjectAnnotated
public static org.apache.ws.commons.schema.XmlSchemaAnnotated getObjectAnnotated(org.apache.ws.commons.schema.XmlSchemaObject object, QName contextName) If the object is an attribute or an anyAttribute, return the 'Annotated'. If it's not one of those, or it's a group, throw. We're not ready for groups yet.- Parameters:
object-
-
getObjectParticle
public static org.apache.ws.commons.schema.XmlSchemaParticle getObjectParticle(org.apache.ws.commons.schema.XmlSchemaObject object, QName contextName, org.apache.ws.commons.schema.XmlSchema currentSchema) If the object is an element or an any, return the particle. If it's not a particle, or it's a group, throw. We're not ready for groups yet.- Parameters:
object-
-
getSequence
public static org.apache.ws.commons.schema.XmlSchemaSequence getSequence(org.apache.ws.commons.schema.XmlSchemaComplexType type) -
getChoice
public static org.apache.ws.commons.schema.XmlSchemaChoice getChoice(org.apache.ws.commons.schema.XmlSchemaComplexType type) -
getAll
public static org.apache.ws.commons.schema.XmlSchemaAll getAll(org.apache.ws.commons.schema.XmlSchemaComplexType type) -
getContentElements
public static List<org.apache.ws.commons.schema.XmlSchemaObject> getContentElements(org.apache.ws.commons.schema.XmlSchemaComplexType type, SchemaCollection collection) -
getContentSequence
public static org.apache.ws.commons.schema.XmlSchemaSequence getContentSequence(org.apache.ws.commons.schema.XmlSchemaComplexType type)
-