Java Code Examples for com.sun.tools.xjc.outline.Outline#getClasses()
The following examples show how to use
com.sun.tools.xjc.outline.Outline#getClasses() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LombokPlugin.java From jaxb-lombok-plugin with MIT License | 6 votes |
@Override public boolean run(Outline outline, Options options, ErrorHandler errorHandler) { // for each generated classes for (ClassOutline generatedClassOutline : outline.getClasses()) { JDefinedClass generatedClass = generatedClassOutline.implClass; if (!isAbstractClass(generatedClass) && !generatedClass.fields().isEmpty()) { boolean commandExecuted = false; for (Command command : commands.values()) { if (command.isEnabled()) { command.editGeneratedClass(generatedClass); commandExecuted = true; } } if (!commandExecuted) { defaultCommand.editGeneratedClass(generatedClass); } } } return true; }
Example 2
Source File: MetaPlugin.java From jaxb2-rich-contract-plugin with MIT License | 6 votes |
@Override public boolean run(final Outline outline, final Options opt, final ErrorHandler errorHandler) throws SAXException { final PluginContext pluginContext = PluginContext.get(outline, opt, errorHandler); if (this.extended && this.generateTools) { pluginContext.writeSourceFile(PropertyInfo.class); pluginContext.writeSourceFile(SinglePropertyInfo.class); pluginContext.writeSourceFile(CollectionPropertyInfo.class); pluginContext.writeSourceFile(IndirectCollectionPropertyInfo.class); pluginContext.writeSourceFile(IndirectPrimitiveCollectionPropertyInfo.class); pluginContext.writeSourceFile(PropertyVisitor.class); pluginContext.writeSourceFile(Property.class); pluginContext.writeSourceFile(SingleProperty.class); pluginContext.writeSourceFile(CollectionProperty.class); pluginContext.writeSourceFile(IndirectCollectionProperty.class); pluginContext.writeSourceFile(IndirectPrimitiveCollectionProperty.class); pluginContext.writeSourceFile(ItemProperty.class); } for (final ClassOutline classOutline : outline.getClasses()) { generateMetaClass(pluginContext, classOutline, errorHandler); } return true; }
Example 3
Source File: ModifierPlugin.java From jaxb2-rich-contract-plugin with MIT License | 6 votes |
@Override public boolean run(final Outline outline, final Options opt, final ErrorHandler errorHandler) throws SAXException { final PluginContext pluginContext = PluginContext.get(outline, opt, errorHandler); for (final ClassOutline classOutline : outline.getClasses()) { try { final GroupInterfacePlugin groupInterfacePlugin = pluginContext.findPlugin(GroupInterfacePlugin.class); if (groupInterfacePlugin != null) { ModifierGenerator.generateClass(pluginContext, new DefinedClassOutline(pluginContext, classOutline), this.modifierClassName, this.modifierClassName, groupInterfacePlugin.getGroupInterfacesForClass(pluginContext, classOutline.implClass.fullName()), this.modifierMethodName); } else { ModifierGenerator.generateClass(pluginContext, new DefinedClassOutline(pluginContext, classOutline), this.modifierClassName, this.modifierMethodName); } } catch (final JClassAlreadyExistsException e) { errorHandler.error(new SAXParseException(e.getMessage(), classOutline.target.getLocator())); } } return true; }
Example 4
Source File: AnnotateOutline.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 6 votes |
public Collection<ClassOutline> process(EjbPlugin context, Outline outline, Options options) throws Exception { logger.debug("Processing outline with context path [" + OutlineUtils.getContextPath(outline) + "]."); final Collection<? extends ClassOutline> classes = outline.getClasses(); final Collection<ClassOutline> processedClassOutlines = new ArrayList<ClassOutline>( classes.size()); for (final ClassOutline classOutline : classes) { if (!getIgnoring() .isClassOutlineIgnored(getMapping(), classOutline)) { final ClassOutline processedClassOutline = process(this, classOutline, options); if (processedClassOutline != null) { processedClassOutlines.add(processedClassOutline); } } } return processedClassOutlines; }
Example 5
Source File: JaxbValidationsPlugins.java From krasa-jaxb-tools with Apache License 2.0 | 6 votes |
public boolean run(Outline model, Options opt, ErrorHandler errorHandler) { try { for (ClassOutline co : model.getClasses()) { List<CPropertyInfo> properties = co.target.getProperties(); for (CPropertyInfo property : properties) { if (property instanceof CElementPropertyInfo) { processElement((CElementPropertyInfo) property, co, model); } else if (property instanceof CAttributePropertyInfo) { processAttribute((CAttributePropertyInfo) property, co, model); } else if (property instanceof CValuePropertyInfo) { processAttribute((CValuePropertyInfo) property, co, model); } } } return true; } catch (Exception e) { log(e); return false; } }
Example 6
Source File: MarshalMappings.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 6 votes |
public Collection<ClassOutline> process(EjbPlugin context, Outline outline, Options options) throws Exception { logger.debug("Processing outline with context path [" + OutlineUtils.getContextPath(outline) + "]."); final Collection<? extends ClassOutline> classes = outline.getClasses(); final Collection<ClassOutline> processedClassOutlines = new ArrayList<ClassOutline>( classes.size()); for (final ClassOutline classOutline : classes) { if (!getIgnoring() .isClassOutlineIgnored(getMapping(), classOutline)) { final ClassOutline processedClassOutline = process(this, classOutline, options); if (processedClassOutline != null) { processedClassOutlines.add(processedClassOutline); } } } return processedClassOutlines; }
Example 7
Source File: AutoInheritancePlugin.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 6 votes |
@Override public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { for (final ClassOutline classOutline : outline.getClasses()) { if (classOutline.target.getElementName() != null) { processGlobalElement(classOutline); } else { processGlobalComplexType(classOutline); } } for (final CElementInfo elementInfo : outline.getModel() .getAllElements()) { final ElementOutline elementOutline = outline .getElement(elementInfo); if (elementOutline != null) { processGlobalJAXBElement(elementOutline); } } return true; }
Example 8
Source File: SettersPlugin.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 5 votes |
public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { for (final ClassOutline classOutline : outline.getClasses()) if (!getIgnoring().isIgnored(classOutline)) { processClassOutline(classOutline); } return true; }
Example 9
Source File: PrimitiveFixerPlugin.java From krasa-jaxb-tools with Apache License 2.0 | 5 votes |
@Override public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) throws SAXException { for (ClassOutline co : outline.getClasses()) { HashMap<String, Class> hashMap = new HashMap<String, Class>(); hashMap.put("int", Integer.class); hashMap.put("long", Long.class); hashMap.put("boolean", Boolean.class); hashMap.put("double", Double.class); hashMap.put("float", Float.class); hashMap.put("byte", Byte.class); hashMap.put("short", Short.class); Map<String, JFieldVar> fields = co.implClass.fields(); for (Map.Entry<String, JFieldVar> stringJFieldVarEntry : fields.entrySet()) { JFieldVar fieldVar = stringJFieldVarEntry.getValue(); JType type = fieldVar.type(); /* * Exclude "serialVersionUID" from processing XReplacePrimitives as this will * have no getter or setter defined. */ if ("serialVersionUID".equals(fieldVar.name())) { continue; } if (type.isPrimitive()) { Class o = hashMap.get(type.name()); if (o != null) { JCodeModel jCodeModel = new JCodeModel(); JClass newType = jCodeModel.ref(o); fieldVar.type(newType); setReturnType(newType, getMethodsMap(MethodType.GETTER, fieldVar, co)); setParameter(newType, getMethodsMap(MethodType.SETTER, fieldVar, co)); } } } } return true; }
Example 10
Source File: MergeablePlugin.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { for (final ClassOutline classOutline : outline.getClasses()) if (!getIgnoring().isIgnored(classOutline)) { processClassOutline(classOutline); } return true; }
Example 11
Source File: DummyXjcPlugin.java From cxf with Apache License 2.0 | 5 votes |
@Override public boolean run(Outline arg0, Options arg1, ErrorHandler arg2) { for (ClassOutline classOutline : arg0.getClasses()) { JDefinedClass implClass = classOutline.implClass; JCodeModel codeModel = implClass.owner(); JMethod dummyMethod = implClass.method(JMod.PUBLIC, codeModel.ref(String.class), "dummy"); dummyMethod.body()._return(JExpr.lit("dummy")); } return true; }
Example 12
Source File: ConnectPlugin.java From kafka-connect-transform-xml with Apache License 2.0 | 5 votes |
@Override public boolean run(Outline model, Options options, ErrorHandler errorHandler) throws SAXException { JCodeModel codeModel = model.getCodeModel(); for (ClassOutline classOutline : model.getClasses()) { log.trace("run - {}", classOutline.implClass.name()); JFieldVar schemaField = processSchema(codeModel, classOutline); processToStruct(schemaField, codeModel, classOutline); processFromStruct(codeModel, classOutline); } return true; }
Example 13
Source File: HashCodePlugin.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { for (final ClassOutline classOutline : outline.getClasses()) { if (!getIgnoring().isIgnored(classOutline)) { processClassOutline(classOutline); } } return true; }
Example 14
Source File: CopyablePlugin.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { for (final ClassOutline classOutline : outline.getClasses()) if (!getIgnoring().isIgnored(classOutline)) { processClassOutline(classOutline); } return true; }
Example 15
Source File: ToStringPlugin.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { for (final ClassOutline classOutline : outline.getClasses()) if (!getIgnoring().isIgnored(classOutline)) { processClassOutline(classOutline); } return true; }
Example 16
Source File: PluginImpl.java From xero-java-client with Apache License 2.0 | 5 votes |
@Override public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) throws SAXException { JCodeModel model = outline.getModel().codeModel; for (ClassOutline co : outline.getClasses()) { updateArrayOfGetters(co, model); updateArrayOfSetters(co, model); } return true; }
Example 17
Source File: EqualsPlugin.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 5 votes |
@Override public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) { for (final ClassOutline classOutline : outline.getClasses()) { if (!getIgnoring().isIgnored(classOutline)) { processClassOutline(classOutline); } } return true; }
Example 18
Source File: DefaultOutlineProcessor.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 5 votes |
public Map<ClassOutline, T> process(C context, Outline outline, Options options) throws Exception { final Map<ClassOutline, T> classMappingsMap = new HashMap<ClassOutline, T>(); for (final ClassOutline classOutline : outline.getClasses()) { final T result = getClassOutlineProcessor().process(context, classOutline, options); if (result != null) { classMappingsMap.put(classOutline, result); } } return classMappingsMap; }
Example 19
Source File: BoundPropertiesPlugin.java From jaxb2-rich-contract-plugin with MIT License | 4 votes |
@Override public boolean run(final Outline outline, final Options opt, final ErrorHandler errorHandler) throws SAXException { if (!this.constrained && !this.bound) { return true; } final PluginContext pluginContext = PluginContext.get(outline, opt, errorHandler); final JCodeModel m = outline.getCodeModel(); if (this.generateTools) { // generate bound collection helper classes pluginContext.writeSourceFile(BoundList.class); pluginContext.writeSourceFile(BoundListProxy.class); pluginContext.writeSourceFile(CollectionChangeEventType.class); pluginContext.writeSourceFile(CollectionChangeEvent.class); pluginContext.writeSourceFile(CollectionChangeListener.class); pluginContext.writeSourceFile(VetoableCollectionChangeListener.class); } if(pluginContext.hasPlugin(ImmutablePlugin.class)) { errorHandler.error(new SAXParseException(getMessage("error.immutableAndConstrainedProperties"), outline.getModel().getLocator())); } final int setterAccess = JMod.PUBLIC; for (final ClassOutline classOutline : outline.getClasses()) { final JDefinedClass definedClass = classOutline.implClass; // Create bound collection proxies for (final FieldOutline fieldOutline : classOutline.getDeclaredFields()) { if (fieldOutline.getPropertyInfo().isCollection() && !definedClass.fields().get(fieldOutline.getPropertyInfo().getName(false)).type().isArray()) { generateProxyField(classOutline, fieldOutline); generateLazyProxyInitGetter(classOutline, fieldOutline); } } if (this.constrained && this.setterThrows) { for (final JMethod method : definedClass.methods()) { if (method.name().startsWith("with") && !"withVetoableChangeListener".equals(method.name()) && !"withPropertyChangeListener".equals(method.name()) ) { method._throws(PropertyVetoException.class); } } } if (this.constrained) createSupportProperty(outline, classOutline, VetoableChangeSupport.class, VetoableChangeListener.class, "vetoableChange"); if (this.bound) createSupportProperty(outline, classOutline, PropertyChangeSupport.class, PropertyChangeListener.class, "propertyChange"); for (final JFieldVar field : definedClass.fields().values()) { //final JFieldVar field = definedClass.fields().get(fieldOutline.getPropertyInfo().getName(false)); final JMethod oldSetter = definedClass.getMethod("set" + outline.getModel().getNameConverter().toPropertyName(field.name()), new JType[]{field.type()}); if (oldSetter != null && !field.type().isArray()) { definedClass.methods().remove(oldSetter); final JMethod setter = definedClass.method(setterAccess, m.VOID, "set" + outline.getModel().getNameConverter().toPropertyName(field.name())); final JVar setterArg = setter.param(JMod.FINAL, field.type(), "value"); final JBlock body = setter.body(); final JVar oldValueVar = body.decl(JMod.FINAL, field.type(), BoundPropertiesPlugin.OLD_VALUE_VAR_NAME, JExpr._this().ref(field)); if (this.constrained) { final JTryBlock tryBlock; final JBlock block; if (this.setterThrows) { block = body; setter._throws(PropertyVetoException.class); } else { tryBlock = body._try(); block = tryBlock.body(); final JCatchBlock catchBlock = tryBlock._catch(m.ref(PropertyVetoException.class)); final JVar exceptionVar = catchBlock.param("x"); catchBlock.body()._throw(JExpr._new(m.ref(RuntimeException.class)).arg(exceptionVar)); } invokeListener(block, field, oldValueVar, setterArg, "vetoableChange"); } body.assign(JExpr._this().ref(field), setterArg); if (this.bound) { invokeListener(body, field, oldValueVar, setterArg, "propertyChange"); } } } } return true; }
Example 20
Source File: AnnotatePlugin.java From jpmml-model with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public boolean run(Outline outline, Options options, ErrorHandler errorHandler){ JCodeModel codeModel = outline.getCodeModel(); Collection<? extends ClassOutline> classOutlines = outline.getClasses(); for(ClassOutline classOutline : classOutlines){ JDefinedClass beanClazz = classOutline.implClass; CPluginCustomization classCustomization = CustomizationUtils.findCustomization(classOutline, AnnotatePlugin.ANNOTATE_CLASS_QNAME); if(classCustomization != null){ annotate(codeModel, beanClazz, classCustomization); } Map<String, JFieldVar> fieldVars = beanClazz.fields(); FieldOutline[] fieldOutlines = classOutline.getDeclaredFields(); for(FieldOutline fieldOutline : fieldOutlines){ CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo(); List<CPluginCustomization> propertyCustomizations = CustomizationUtils.findPropertyCustomizationsInProperty(propertyInfo, AnnotatePlugin.ANNOTATE_PROPERTY_QNAME); for(CPluginCustomization propertyCustomization : propertyCustomizations){ JFieldVar fieldVar = fieldVars.get(propertyInfo.getName(false)); annotate(codeModel, fieldVar, propertyCustomization); } } } Collection<? extends EnumOutline> enumOutlines = outline.getEnums(); for(EnumOutline enumOutline : enumOutlines){ JDefinedClass clazz = enumOutline.clazz; CPluginCustomization enumCustomization = CustomizationUtils.findCustomization(enumOutline, AnnotatePlugin.ANNOTATE_ENUM_QNAME); if(enumCustomization != null){ annotate(codeModel, clazz, enumCustomization); } List<EnumConstantOutline> enumConstantOutlines = enumOutline.constants; for(EnumConstantOutline enumConstantOutline : enumConstantOutlines){ CCustomizations enumConstantCustomizations = enumConstantOutline.target.getCustomizations(); for(CPluginCustomization enumConstantCustomization : enumConstantCustomizations){ Element element = enumConstantCustomization.element; if((AnnotatePlugin.ANNOTATE_ENUM_CONSTANT_QNAME.getNamespaceURI()).equals(element.getNamespaceURI()) && (AnnotatePlugin.ANNOTATE_ENUM_CONSTANT_QNAME.getLocalPart()).equals(element.getLocalName())){ annotate(codeModel, enumConstantOutline.constRef, enumConstantCustomization); enumConstantCustomization.markAsAcknowledged(); } } } } return true; }