LazyList ll = new LazyList(); // Add a couple million objects ll.multiplyList(2);
/** * Constructor with single schema customization as content. * * @param child */ public SchemasetCustom(SchemaCustom child) { super(null); child.setParent(this); getChildren().add(child); m_schemaMap = new HashMap(); } /**
/** * Constructor. * * @param parent parent */ public NestingCustomBase(NestingCustomBase parent) { super(parent); m_children = new LazyList(); }
/** * Constructor from message name and singleton part. * * @param name message name * @param tns target namespace */ public Message(String name, String tns) { m_name = name; m_qName = new QName(tns, name); m_parts = new LazyList(); }
/** * Validate and finalize customization information. This override of the base class implementation also invokes the * same method on any nested schemasets in order to make sure that the type substitution map and active facets mask * will be available for use by nested schemas. * * @param vctx validation context * @return <code>true</code> if valid, <code>false</code> if not */ public boolean validate(ValidationContext vctx) { boolean valid = super.validate(vctx); if (valid) { LazyList children = getChildren(); for (int i = 0; i < children.size(); i++) { Object child = children.get(i); if (child instanceof SchemasetCustom) { if (!((SchemasetCustom)child).validate(vctx)) { valid = false; } } } } return valid; }
/** * Constructor. * * @param name class name * @param base base class name * @param pack package information * @param holder binding holder * @param nconv name converter * @param decorators class decorators * @param inner use inner classes for substructures * @param simple simple value flag */ public ClassHolder(String name, String base, PackageHolder pack, BindingHolder holder, NameConverter nconv, ClassDecorator[] decorators, boolean inner, boolean simple) { super(buildName(name, pack), simple); m_package = pack; m_holder = holder; m_nameConverter = nconv; m_name = name; m_baseName = base; m_decorators = decorators; m_useInnerClasses = inner; m_importsTracker = new ImportsTracker(pack.getName()); m_outerClass = null; m_inners = new LazyList(); m_nameSet = new UniqueNameSet(); m_nameSet.add(name); m_importsTracker.addLocalType(name, getFullName()); }
@SuppressWarnings("unchecked") private SchemasetCustom defaultSchemasetCustom(Map<String, Element> smap) { SchemasetCustom customRoot = new SchemasetCustom((SchemasetCustom)null); Set<String> schemaIds = smap.keySet(); for (String schemaId : schemaIds) { SchemaCustom schemaCustom = new SchemaCustom(customRoot); schemaCustom.setName(schemaId); schemaCustom.setForceTypes(Boolean.TRUE); schemaCustom.setNamespace(smap.get(schemaId).getAttribute("targetNamespace")); customRoot.getChildren().add(schemaCustom); } for (JibxSchemaResolver r : resolvers) { if (!schemaIds.contains(r.getId())) { SchemaCustom schemaCustom = new SchemaCustom(customRoot); schemaCustom.setName(r.getName()); schemaCustom.setNamespace(r.getElement().getAttribute("targetNamespace")); schemaCustom.setForceTypes(Boolean.TRUE); customRoot.getChildren().add(schemaCustom); } } return customRoot; }
/** * Recursively check that each schema customization has been matched to a schema. A warning is generated for any * customization without a matching schema. * * @param vctx */ public void checkSchemas(ValidationContext vctx) { // check for unique match to schema customization for (int i = 0; i < getChildren().size(); i++) { SchemaRootBase child = (SchemaRootBase)getChildren().get(i); if (child instanceof SchemaCustom) { SchemaCustom custom = (SchemaCustom)child; if (custom.getSchema() == null) { StringBuffer buff = new StringBuffer("No schema loaded for customization"); if (custom.getName() != null) { buff.append(" with name "); buff.append(custom.getName()); } else if (custom.getNamespace() != null) { buff.append(" with namespace "); buff.append(custom.getNamespace()); } vctx.addWarning(buff.toString(), custom); } } else if (child instanceof SchemasetCustom) { ((SchemasetCustom)child).checkSchemas(vctx); } } }
/** * Constructor for creating a child inner class definition. * * @param name class name * @param context parent class * @param simple simple value flag */ protected ClassHolder(String name, ClassHolder context, boolean simple) { super(context.getFullName() + '.' + name, context.getBindingName() + '$' + name, simple); m_package = context.m_package; m_holder = context.m_holder; m_nameConverter = context.m_nameConverter; m_name = name; m_baseName = null; m_decorators = context.m_decorators; m_useInnerClasses = true; m_importsTracker = context.m_importsTracker; m_outerClass = context; m_inners = new LazyList(); m_nameSet = new UniqueNameSet(); ClassHolder scan = this; while (scan != null) { m_nameSet.add(scan.getName()); scan = scan.m_outerClass; } m_importsTracker.addLocalType(name, getFullName()); m_package.addInnerClass(this); }
child = group.isEnumeration() ? new EnumerationClassHolder(text, this) : (ClassHolder)new StructureClassHolder(text, this); m_inners.add(child); if (s_logger.isDebugEnabled()) { s_logger.debug("Added inner class " + child.getFullName());
/** * Recursively add all inner enumeration classes as formats to a <mapping> definition. This is used to create the * <format> elements for all nested enumerations, which need to be direct children of the <mapping> element * for the top-level class. * * @param mapping Mapping */ private void addInnerFormats(MappingElementBase mapping) { for (int i = 0; i < m_inners.size(); i++) { ClassHolder inner = (ClassHolder)m_inners.get(i); if (inner.isSimpleValue()) { FormatElement format = new FormatElement(); format.setTypeName(inner.getBindingName()); ((EnumerationClassHolder)inner).setBinding(format); mapping.addTopChild(format); } else { ((StructureClassHolder)inner).addInnerFormats(mapping); } } }