@Override public MapDataSchema getSchema() { return (MapDataSchema) super.getSchema(); }
public TSRecordFieldSyntax(RecordTemplateSpec _template, RecordTemplateSpec.Field _field) { this._template = _template; this._schema = _template.getSchema(); this._field = _field; }
TSPrimitiveTypeSyntax(PrimitiveTemplateSpec _template) { this._template = _template; this._schema = _template.getSchema(); }
public static Set<ClassTemplateSpec> directReferencedTypes(ClassTemplateSpec spec) { Set<ClassTemplateSpec> results = new HashSet<ClassTemplateSpec>(); if (spec instanceof RecordTemplateSpec) { RecordTemplateSpec recordSpec = (RecordTemplateSpec)spec; for (RecordTemplateSpec.Field field: recordSpec.getFields()) { results.add(field.getType()); } } else if (spec instanceof UnionTemplateSpec) { UnionTemplateSpec unionSpec = (UnionTemplateSpec)spec; for (UnionTemplateSpec.Member member: unionSpec.getMembers()) { results.add(member.getClassTemplateSpec()); } } else if (spec instanceof CourierMapTemplateSpec) { CourierMapTemplateSpec mapSpec = (CourierMapTemplateSpec)spec; if (mapSpec.getKeyClass() != null) { results.add(mapSpec.getKeyClass()); } results.add(mapSpec.getValueClass()); } else if (spec instanceof ArrayTemplateSpec) { ArrayTemplateSpec arraySpec = (ArrayTemplateSpec)spec; results.add(arraySpec.getItemClass()); } return results; }
public String docString() { if (this._template.getTyperefClass() != null) { return new TSNamedTypeSyntax(this._template.getTyperefClass().getSchema()).docString(); } else { return ""; } }
private ClassTemplateSpec getDereferencedType(CustomInfoSpec customInfo, ClassTemplateSpec fallback) { if (customInfo != null) { DataSchema refSchema = customInfo.getCustomSchema().getDereferencedDataSchema(); return ClassTemplateSpec.createFromDataSchema(refSchema); } else { return fallback; } }
/** * Returns the escaped fully qualified name of a {@link ClassTemplateSpec}. * * @param spec to build a escaped fully qualified name for. * * @return the escaped fullname. */ public static String escapedFullname(ClassTemplateSpec spec) { return toFullname(spec.getNamespace(), escapeKeyword(spec.getClassName())); }
private RecordDataSchema.Field _schemaField() { return _field.getSchemaField(); } private TSTypeSyntax _fieldTypeSyntax() {
private ClassTemplateSpec createFromDataSchema(DataSchema schema) { if (schema instanceof MapDataSchema) { return new CourierMapTemplateSpec((MapDataSchema) schema); } return ClassTemplateSpec.createFromDataSchema(schema); }
public boolean isEquatable() { if (classSpec instanceof UnionTemplateSpec) { UnionTemplateSpec unionSpec = (UnionTemplateSpec)classSpec; TyperefTemplateSpec typerefSpec = unionSpec.getTyperefClass(); if (typerefSpec == null) return globalConfig.defaults.equatable; return globalConfig.lookupSwiftProperties(typerefSpec).equatable; } else { return swiftProperties.equatable; } }
/** * Returns the escaped fully qualified name of a {@link ClassTemplateSpec}. * * @param spec to build a escaped fully qualified name for. * * @return the escaped fullname. */ public static String escapedFullname(ClassTemplateSpec spec) { // TODO: Remove below null and introduce module namespacing return toFullname(null, escapeKeyword(spec.getClassName())); }
private TSTypeSyntax _memberTypeSyntax() { return createTypeSyntax(_member.getSchema()); } }
public TSUnionSyntax(UnionTemplateSpec _template) { this._template = _template; this._schema = _template.getSchema(); }
private boolean _isEnclosedType() { return _template.getEnclosingClass() != null; } }
public TSEnumSyntax(EnumTemplateSpec _template) { this._template = _template; this._dataSchema = _template.getSchema(); this._namedTypeSyntax = new TSNamedTypeSyntax(_dataSchema); }
public static boolean isTypedDefinition(UnionTemplateSpec unionSpec) { TyperefTemplateSpec typerefClass = unionSpec.getTyperefClass(); return (typerefClass != null && typerefClass.getSchema().getProperties().containsKey("typedDefinition")); }
private DataSchema _memberSchema() { return _member.getSchema(); } private TSTypeSyntax _memberTypeSyntax() {
public TSRecordSyntax(RecordTemplateSpec _template) { this._template = _template; this._schema = _template.getSchema(); this._namedTypeSyntax = new TSNamedTypeSyntax(_schema); }
public static boolean isFlatTypedDefinition(UnionTemplateSpec unionSpec) { TyperefTemplateSpec typerefClass = unionSpec.getTyperefClass(); return (typerefClass != null && typerefClass.getSchema().getProperties().containsKey("flatTypedDefinition")); }
public String unionMemberKey() { return _member.getSchema().getUnionMemberKey(); }