Refine search
public ClassSelector() { classBinder = new Abstractifier(new DefaultClassBinder()); Ring.add(ClassBinder.class,classBinder); classScopes.push(null); // so that the getClassFactory method returns null XSComplexType anyType = Ring.get(XSSchemaSet.class).getComplexType(WellKnownNamespace.XML_SCHEMA,"anyType"); bindMap.put(anyType,new Binding(anyType,CBuiltinLeafInfo.ANYTYPE)); }
/** * Entry point. */ public static Model build( XSSchemaSet _schemas, JCodeModel codeModel, ErrorReceiver _errorReceiver, Options opts ) { // set up a ring final Ring old = Ring.begin(); try { ErrorReceiverFilter ef = new ErrorReceiverFilter(_errorReceiver); Ring.add(XSSchemaSet.class,_schemas); Ring.add(codeModel); Model model = new Model(opts, codeModel, null/*set later*/, opts.classNameAllocator, _schemas); Ring.add(model); Ring.add(ErrorReceiver.class,ef); Ring.add(CodeModelClassFactory.class,new CodeModelClassFactory(ef)); BGMBuilder builder = new BGMBuilder(opts.defaultPackage,opts.defaultPackage2, opts.isExtensionMode(),opts.getFieldRendererFactory()); builder._build(); if(ef.hadError()) return null; else return model; } finally { Ring.end(old); } }
this.mRing3 = TextureRegionFactory.extractFromTexture(ring3); this.mStack1 = new Stack<Ring>(); this.mStack2 = new Stack<Ring>(); this.mStack3 = new Stack<Ring>(); } catch (IOException e) { Debug.e(e); Ring ring1 = new Ring(1, 139, 174, this.mRing1, getVertexBufferObjectManager()) { @Override public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) { Ring ring2 = new Ring(2, 118, 212, this.mRing2, getVertexBufferObjectManager()) { @Override public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) { Ring ring3 = new Ring(3, 97, 255, this.mRing3, getVertexBufferObjectManager()) { @Override public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
final Ring old = Ring.begin(); try { ErrorReceiverFilter ef = new ErrorReceiverFilter(errorReceiver); JCodeModel cm = new JCodeModel(); Model model = new Model(opts,cm,NameConverter.standard,opts.classNameAllocator,null); Ring.add(cm); Ring.add(model); Ring.add(ErrorReceiver.class,ef); Ring.get(ModelChecker.class).check(); Ring.end(old);
@Override protected void runInternal(Outline outline) throws ClassNotFoundException, IOException { final JCodeModel codeModel = outline.getCodeModel(); final JClass xmlElementWrapperModelClass = codeModel.ref(XmlElementWrapper.class); final JClass xmlElementModelClass = codeModel.ref(XmlElement.class); final JClass xmlAnyElementModelClass = codeModel.ref(XmlAnyElement.class); final JClass xmlMixedModelClass = codeModel.ref(XmlMixed.class); final JClass xmlElementRefModelClass = codeModel.ref(XmlElementRef.class); final JClass qNameModelClass = codeModel.ref(QName.class); Ring.begin(); Ring.add(outline.getModel()); Ring.end(null);
/** * The whole type set can be later bound to a reference property, * in which case we need to generate additional code to wrap this * type reference into an element class. * * This method generates such an element class and returns it. */ protected void toElementRef(CReferencePropertyInfo prop) { CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean(); Model model = Ring.get(Model.class); CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList(); if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) { CClassInfo bean = new CClassInfo(model,scope, model.getNameConverter().toClassName(decl.getName()), decl.getLocator(), null, BGMBuilder.getName(decl), decl, custs); bean.setBaseClass((CClassInfo)target); prop.getElements().add(bean); } else { CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target, decl.getDefaultValue(), decl, custs, decl.getLocator()); prop.getElements().add(e); } }
@Override public boolean run(Outline outline, Options options) throws Exception { final Ring ring = Ring.begin(); Ring.add(this.bgmBuilder); Ring.add(outline.getModel()); throw ex; } finally { Ring.end(ring); for (final CPropertyInfo propertyInfo : classInfo.getProperties()) { if (outline.getField(propertyInfo) == null) { generateFieldDecl(outline, (ClassOutlineImpl) classOutline,
if( bean.getName().equals(reservedClassName) ) { getErrorReporter().error( sc.getLocator(), Messages.ERR_RESERVED_CLASS_NAME, reservedClassName ); bean.addConstructor("value"); pushClassScope(bean); else pushClassScope(bean.parent()); XSComponent oldRoot = currentRoot; CClassInfo oldBean = currentBean; currentRoot = sc; currentBean = bean; sc.visit(Ring.get(BindRed.class)); currentBean = oldBean; currentRoot = oldRoot;
/** * Runs the check. */ void run() { for( XSSchema s : Ring.get(XSSchemaSet.class).getSchemas() ) { schema(s); run( s.getAttGroupDecls() ); run( s.getAttributeDecls() ); run( s.getComplexTypes() ); run( s.getElementDecls() ); run( s.getModelGroupDecls() ); run( s.getNotations() ); run( s.getSimpleTypes() ); } }
/** * Performs error check */ public void errorCheck() { ErrorReceiver er = Ring.get(ErrorReceiver.class); for (QName n : enumBaseTypes) { XSSchemaSet xs = Ring.get(XSSchemaSet.class); XSSimpleType st = xs.getSimpleType(n.getNamespaceURI(), n.getLocalPart()); if(st==null) { er.error(loc,Messages.ERR_UNDEFINED_SIMPLE_TYPE.format(n)); continue; } if(!SimpleTypeBuilder.canBeMappedToTypeSafeEnum(st)) { er.error(loc,Messages.ERR_CANNOT_BE_BOUND_TO_SIMPLETYPE.format(n)); continue; } } }
protected final void createSimpleTypeProperty(XSSimpleType type,String propName) { BIProperty prop = BIProperty.getCustomization(type); SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class); // since we are building the simple type here, use buildDef CPropertyInfo p = prop.createValueProperty(propName,false,type,stb.buildDef(type),BGMBuilder.getName(type)); getCurrentBean().addProperty(p); }
public CClassInfo(Model model,CClassInfoParent p, String shortName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations) { super(model,source,location,customizations); this.model = model; this.parent = p; this.shortName = model.allocator.assignClassName(parent,shortName); this.typeName = typeName; this.elementName = elementName; Language schemaLanguage = model.options.getSchemaLanguage(); if ((schemaLanguage != null) && (schemaLanguage.equals(Language.XMLSCHEMA) || schemaLanguage.equals(Language.WSDL))) { BIFactoryMethod factoryMethod = Ring.get(BGMBuilder.class).getBindInfo(source).get(BIFactoryMethod.class); if(factoryMethod!=null) { factoryMethod.markAsAcknowledged(); this.squeezedName = factoryMethod.name; } } model.add(this); }
protected CPropertyInfo(String name, boolean collection, XSComponent source, CCustomizations customizations, Locator locator) { this.publicName = name; String n = null; Model m = Ring.get(Model.class); if (m != null) { n = m.getNameConverter().toVariableName(name); } else { n = NameConverter.standard.toVariableName(name); } if(!JJavaName.isJavaIdentifier(n)) n = '_'+n; // avoid colliding with the reserved names like 'abstract'. this.privateName = n; this.isCollection = collection; this.locator = locator; if(customizations==null) this.customizations = CCustomizations.EMPTY; else this.customizations = customizations; this.source = source; }
protected ParticleBinder() { // make sure that this object is available as ParticleBinder, not as their actual implementation classes Ring.add(ParticleBinder.class,this); }
private void _build() { // do the binding buildContents(); getClassSelector().executeTasks(); // additional error check // Reports unused customizations to the user as errors. Ring.get(UnusedCustomizationChecker.class).run(); Ring.get(ModelChecker.class).check(); for( Plugin ma : activePlugins ) ma.postProcessModel(model, Ring.get(ErrorReceiver.class)); }
public Ring initialValue() { return new Ring(); } };