private void emitLeafList(final LeafListSchemaNode child) { super.writer.startLeafListNode(child.getQName()); child.getWhenCondition().ifPresent(this::emitWhen); // FIXME: BUG-2444: *(ifFeatureNode ) emitTypeNode(child.getPath(), child.getType()); child.getType().getUnits().ifPresent(this::emitUnitsNode); // FIXME: BUG-2444: unitsNode /Optional child.getMustConstraints().forEach(this::emitMust); emitConfigNode(child.isConfiguration()); emitDefaultNodes(child.getDefaults()); child.getElementCountConstraint().ifPresent(this::emitCountConstraint); emitOrderedBy(child.isUserOrdered()); emitDocumentedNode(child); emitUnknownStatementNodes(child.getUnknownSchemaNodes()); super.writer.endNode(); }
public JavaAttribute(final LeafListSchemaNode leaf, final TypeProviderWrapper typeProviderWrapper) { super(leaf); this.type = typeProviderWrapper.getType(leaf); this.typeDefinition = leaf.getType(); this.typeProviderWrapper = typeProviderWrapper; this.nullableDefault = nullableDefaultWrappedForCode = null; this.nullableDescription = leaf.getDescription(); }
private JSONObject processLeafListNode(final LeafListSchemaNode listNode) throws JSONException { JSONObject props = new JSONObject(); props.put(TYPE_KEY, ARRAY_TYPE); JSONObject itemsVal = new JSONObject(); processTypeDef(listNode.getType(), itemsVal); props.put(ITEMS_KEY, itemsVal); ConstraintDefinition constraints = listNode.getConstraints(); processConstraints(constraints, props); return props; }
LeafListEntryNormalization(final LeafListSchemaNode potential) { super(new NodeWithValue<>(potential.getQName(), null)); }
final QName nodeName = node.getQName(); if (nodeName != null && !node.isAddedByUses()) { final TypeDefinition<?> typeDef = node.getType(); final Module parentModule = findParentModule(schemaContext, node); typeBuilder,module); returnType = new ReferencedTypeImpl(enumBuilder.getPackageName(), enumBuilder.getName()); ((TypeProviderImpl) typeProvider).putReferencedType(node.getPath(), returnType); } else if (typeDef instanceof UnionType) { final GeneratedTOBuilder genTOBuilder = addTOToTypeBuilder(typeDef, typeBuilder, node, parentModule); constructGetter(typeBuilder, nodeName.getLocalName(), node.getDescription(), listType); return true;
/** * Checks if <code>dataNode</code> is <code>LeafListSchemaNode</code> and if it so then checks if it is of type * <code>EnumTypeDefinition</code>. * * @param dataNode data schema node for which is checked if it is leaflist and if it is of enum type * @return boolean value * <ul> * <li>true - if <code>dataNode</code> is leaflist of type * enumeration</li> * <li>false - other cases</li> * </ul> */ private static boolean leafListContainsEnumDefinition(final SchemaNode dataNode) { if (dataNode instanceof LeafListSchemaNode) { final LeafListSchemaNode leafList = (LeafListSchemaNode) dataNode; return leafList.getType() instanceof EnumTypeDefinition; } return false; }
private static DataNormalizationOperation<?> fromLeafListSchemaNode(final LeafListSchemaNode potential) { if (potential.isUserOrdered()) { return new OrderedLeafListMixinNormalization(potential); } return new UnorderedLeafListMixinNormalization(potential); }
public static CharSequence writeLeafListSchemaNode(final LeafListSchemaNode leafListSchemaNode) { StringConcatenation _builder = new StringConcatenation(); _builder.append("leaf-list "); QName _qName = leafListSchemaNode.getQName(); String _localName = _qName.getLocalName(); _builder.append(_localName, ""); _builder.append(" {"); _builder.newLineIfNotEmpty(); _builder.append(" "); _builder.append("type "); TypeDefinition<? extends TypeDefinition<?>> _type = leafListSchemaNode.getType(); QName _qName_1 = _type.getQName(); String _localName_1 = _qName_1.getLocalName(); _builder.append(_localName_1, " "); _builder.append(";"); _builder.newLineIfNotEmpty(); _builder.append("}"); _builder.newLine(); return _builder; }
public static ListAttribute create(LeafListSchemaNode node, TypeProviderWrapper typeProvider) { JavaAttribute innerAttribute = new JavaAttribute(node, typeProvider); return new ListAttribute(node, innerAttribute, node.getDescription()); }
LeafListEntryContextNode(final LeafListSchemaNode potential) { super(new NodeWithValue<>(potential.getQName(), null), potential); }
if (node == null || typeBuilder == null || node.isAddedByUses()) { return false; final QName nodeName = node.getQName(); final TypeDefinition<?> typeDef = node.getType(); final Module parentModule = findParentModule(schemaContext, node); typeBuilder, context); returnType = new ReferencedTypeImpl(enumBuilder.getIdentifier()); typeProvider.putReferencedType(node.getPath(), returnType); } else if (typeDef instanceof UnionTypeDefinition) { final UnionTypeDefinition unionDef = (UnionTypeDefinition)typeDef; final Restrictions restrictions = BindingGeneratorUtil.getRestrictions(typeDef); returnType = typeProvider.javaTypeForSchemaDefinitionType(typeDef, node, restrictions); addPatternConstant(typeBuilder, node.getQName().getLocalName(), restrictions.getPatternConstraints()); addPatternConstant(typeBuilder, node.getQName().getLocalName(), restrictions.getPatternConstraints());
/** * Checks if <code>dataNode</code> is <code>LeafListSchemaNode</code> and if * it so then checks if it is of type <code>EnumTypeDefinition</code>. * * @param dataNode * data schema node for which is checked if it is leaflist and if * it is of enum type * @return boolean value * <ul> * <li>true - if <code>dataNode</code> is leaflist of type * enumeration</li> * <li>false - other cases</li> * </ul> */ private static boolean leafListContainsEnumDefinition(final SchemaNode dataNode) { if (dataNode instanceof LeafListSchemaNode) { final LeafListSchemaNode leafList = (LeafListSchemaNode) dataNode; if (leafList.getType() instanceof EnumTypeDefinition) { return true; } } return false; }
private static InstanceIdToNodes<?> fromLeafListSchemaNode(final LeafListSchemaNode potential) { return potential.isUserOrdered() ? new InstanceIdToCompositeNodes.OrderedLeafListMixinNormalization(potential) : new InstanceIdToCompositeNodes.UnorderedLeafListMixinNormalization(potential); } }
LeafListEntryNormalization(final LeafListSchemaNode potential) { super(new NodeWithValue(potential.getQName(), null),potential); }
/** * Return a {@link LeafsetEntryInterner} for a particular schema. Interner instances must be used only for leafset * entries for that particular schema, otherwise they may produce unexpected results. * * @param schema Schema of the parent leaf set * @return An interner instance, or null if the leafset's type should not be interned. */ public static @Nullable LeafsetEntryInterner forSchema(final @Nullable LeafListSchemaNode schema) { if (schema != null) { final TypeDefinition<?> type = schema.getType(); if (type instanceof BooleanTypeDefinition || type instanceof EnumTypeDefinition || type instanceof IdentityrefTypeDefinition) { return INSTANCE; } } return null; } }
private static InstanceIdToNodes<?> fromLeafListSchemaNode(final LeafListSchemaNode potential) { return potential.isUserOrdered() ? new InstanceIdToCompositeNodes.OrderedLeafListMixinNormalization(potential) : new InstanceIdToCompositeNodes.UnorderedLeafListMixinNormalization(potential); } }
LeafListEntryContextNode(final LeafListSchemaNode potential) { super(new NodeWithValue<>(potential.getQName(), null), potential); }
/** * Return a {@link LeafsetEntryInterner} for a particular schema. Interner instances must be used only for leafset * entries for that particular schema, otherwise they may produce unexpected results. * * @param schema Schema of the parent leaf set * @return An interner instance, or null if the leafset's type should not be interned. */ public static @Nullable LeafsetEntryInterner forSchema(final @Nullable LeafListSchemaNode schema) { if (schema != null) { final TypeDefinition<?> type = schema.getType(); if (type instanceof BooleanTypeDefinition || type instanceof EnumTypeDefinition || type instanceof IdentityrefTypeDefinition) { return INSTANCE; } } return null; } }
private static DataSchemaContextNode<?> fromLeafListSchemaNode(final LeafListSchemaNode potential) { if (potential.isUserOrdered()) { return new OrderedLeafListMixinContextNode(potential); } return new UnorderedLeafListMixinContextNode(potential); }
LeafListEntryNormalization(final LeafListSchemaNode potential) { super(new NodeWithValue<>(potential.getQName(), null)); }