Codota Logo
Model
Code IndexAdd Codota to your IDE (free)

How to use
Model
in
com.sun.tools.xjc.model

Best Java code snippets using com.sun.tools.xjc.model.Model (Showing top 20 results out of 315)

Refine searchRefine arrow

  • NameConverter
  • CClassInfo
  • JCodeModel
  • QName
  • Ring
  • Common ways to obtain Model
private void myMethod () {
Model m =
  • Codota IconOutline outline;outline.getModel()
  • Codota IconRing.get(Model.class)
  • Codota IconOptions opt;ErrorReceiver er;ModelLoader.load(opt, new JCodeModel(), er)
  • Smart code suggestions by Codota
}
origin: Evolveum/midpoint

private void addComplexType(Outline outline, Map<String, JFieldVar> namespaceFields) {
  Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
  for (Map.Entry<NClass, CClassInfo> entry : set) {
    ClassOutline classOutline = outline.getClazz(entry.getValue());
    QName qname = entry.getValue().getTypeName();
    if (qname == null) {
      continue;
    }
    JFieldVar namespaceField = namespaceFields.get(qname.getNamespaceURI());
    createQName(outline, classOutline.implClass, COMPLEX_TYPE_FIELD_NAME, qname, namespaceField, false, false);
  }
}
origin: org.jvnet.jaxb2_commons/tools

public static CCustomizations getCustomizations(final Model model) {
  final CCustomizations main = new CCustomizations(model
      .getCustomizations());
  return main;
}
origin: org.glassfish.metro/webservices-tools

private CClassInfo createDefaultClass() {
  String className = owner.model.getNameConverter().toClassName(name);
  QName tagName = new QName("",name);
  return new CClassInfo(owner.model,owner.getTargetPackage(),className,locator,null,tagName,null,null/*TODO*/);
}
origin: sun-jaxb/jaxb-xjc

JAXBModelImpl(Outline outline) {
  this.model = outline.getModel();
  this.outline = outline;
  for (CClassInfo ci : model.beans().values()) {
    if(!ci.isElement())
      continue;
    byXmlName.put(ci.getElementName(),new BeanMappingImpl(this,ci));
  }
  for (CElementInfo ei : model.getElementMappings(null).values()) {
    byXmlName.put(ei.getElementName(),new ElementMappingImpl(this,ei));
  }
}
origin: sun-jaxb/jaxb-xjc

/**
 * Returns all <i>used</i> JPackages.
 *
 * A JPackage is considered as "used" if a ClassItem or
 * a InterfaceItem resides in that package.
 *
 * This value is dynamically calculated every time because
 * one can freely remove ClassItem/InterfaceItem.
 *
 * @return
 *         Given the same input, the order of packages in the array
 *         is always the same regardless of the environment.
 */
public final JPackage[] getUsedPackages( Aspect aspect ) {
  Set<JPackage> s = new TreeSet<JPackage>();
  for( CClassInfo bean : model.beans().values() ) {
    JClassContainer cont = getContainer(bean.parent(),aspect);
    if(cont.isPackage())
      s.add( (JPackage)cont );
  }
  for( CElementInfo e : model.getElementMappings(null).values() ) {
    // at the first glance you might think we should be iterating all elements,
    // not just global ones, but if you think about it, local ones live inside
    // another class, so those packages are already enumerated when we were
    // walking over CClassInfos.
    s.add( e._package() );
  }
  return s.toArray(new JPackage[s.size()]);
}
origin: org.glassfish.metro/webservices-tools

private void mapToClass(DElementPattern p) {
  NameClass nc = p.getName();
  if(nc.isOpen())
    return;   // infinite name. can't map to a class.
  Set<QName> names = nc.listNames();
  CClassInfo[] types = new CClassInfo[names.size()];
  int i=0;
  for( QName n : names ) {
    // TODO: read class names from customization
    String name = model.getNameConverter().toClassName(n.getLocalPart());
    bindQueue.put(
      types[i++] = new CClassInfo(model,pkg,name,p.getLocation(),null,n,null,null/*TODO*/),
      p.getChild() );
  }
  classes.put(p,types);
}
origin: mklemm/jaxb2-rich-contract-plugin

public <T> T getCustomization(final Class<T> customizationClass, final Deque<CCustomizable> schemaComponents) {
  final QName qName = getQName(customizationClass);
  if (!schemaComponents.isEmpty()) {
    final CCustomizable schemaComponent = schemaComponents.pop();
    final CPluginCustomization pluginCustomization = schemaComponent.getCustomizations().find(qName.getNamespaceURI(), qName.getLocalPart());
    if (pluginCustomization == null) {
      return getCustomization(customizationClass, schemaComponents);
    } else {
      pluginCustomization.markAsAcknowledged();
      return JAXB.unmarshal(new DOMSource(pluginCustomization.element), customizationClass);
    }
  } else {
    final CPluginCustomization pluginCustomization = this.outline.getModel().getCustomizations().find(qName.getNamespaceURI(), qName.getLocalPart());
    if (pluginCustomization != null) {
      pluginCustomization.markAsAcknowledged();
      return JAXB.unmarshal(new DOMSource(pluginCustomization.element), customizationClass);
    } else {
      return null;
    }
  }
}
origin: Evolveum/midpoint

private void addContainerName(Outline outline, Map<String, JFieldVar> namespaceFields) {
  Map<QName, List<QName>> complexTypeToElementName = null;
  Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
  for (Map.Entry<NClass, CClassInfo> entry : set) {
    CClassInfo classInfo = entry.getValue();
    JFieldVar var = namespaceFields.get(qname.getNamespaceURI());
    JInvocation invocation = JExpr._new(CLASS_MAP.get(QName.class));
    if (var != null) {
      JClass schemaClass = outline.getModel().codeModel._getClass(StepSchemaConstants.SCHEMA_CONSTANTS_GENERATED_CLASS_NAME);
      invocation.arg(schemaClass.staticRef(var));
      invocation.arg(qname.getLocalPart());
    } else {
      invocation.arg(qname.getNamespaceURI());
      invocation.arg(qname.getLocalPart());
origin: Evolveum/midpoint

for (CElementInfo elementInfo : outline.getModel().getAllElements()) {
  QName name = elementInfo.getElementName();
  XSComponent elementDecl;
    elementDecl = elementInfo.getSchemaComponent();
  } else {
    elementDecl = schemaSet.getElementDecl(name.getNamespaceURI(), name.getLocalPart());
          nameValue.generate(nameFormatter);
          if (("\""+name.getNamespaceURI()+"\"").equals(namespaceWriter.toString()) &&
              ("\""+name.getLocalPart()+"\"").equals(nameWriter.toString())) {
            print("*** Annotating method as @Raw: " + method.name());
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc

/**
 * Returns the "squeezed name" of this element.
 *
 * @see CClassInfo#getSqueezedName()
 */
@XmlElement
public String getSqueezedName() {
  if(squeezedName!=null)  return squeezedName;
  
  StringBuilder b = new StringBuilder();
  CClassInfo s = getScope();
  if(s!=null)
    b.append(s.getSqueezedName());
  if(className!=null)
    b.append(className);
  else
    b.append( model.getNameConverter().toClassName(tagName.getLocalPart()));
  return b.toString();
}
origin: Evolveum/midpoint

@Override
public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) throws Exception {
  Model model = outline.getModel();
  JDefinedClass schemaConstants = model.codeModel._class(SCHEMA_CONSTANTS_GENERATED_CLASS_NAME);
  Map<QName, CElementInfo> map = model.getElementMappings(null);
  Set<Map.Entry<QName, CElementInfo>> set = map.entrySet();
  for (Map.Entry<QName, CElementInfo> entry : set) {
    JFieldVar var = namespaceFields.get(field.getValue().getNamespaceURI());
    createQName(outline, schemaConstants, field.getFieldName(), field.getValue(), var, true, true);
origin: Evolveum/midpoint

public static ClassOutline findClassOutline(Outline outline, QName type) {
  Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
  for (Map.Entry<NClass, CClassInfo> entry : set) {
    ClassOutline classOutline = outline.getClazz(entry.getValue());
    QName qname = entry.getValue().getTypeName();
    if (!type.equals(qname)) {
      continue;
    }
    return classOutline;
  }
  throw new IllegalStateException("Object type class defined by qname '" + type + "' outline was not found.");
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc

for (CEnumLeafInfo p : model.enums().values()) {
  enums.put(p, generateEnumDef(p));
for (CClassInfo bean : model.beans().values()) {
  getClazz(bean);
JClass OBJECT = codeModel.ref(Object.class);
  CClassInfo superClass = cc.target.getBaseClass();
  if (superClass != null) {
    CClassRef refSuperClass = cc.target.getRefBaseClass();
    if (refSuperClass != null) {
      cc.implClass._extends(refSuperClass.toType(this, EXPOSED));
  CClassInfoParent base = cc.target.parent();
  if ((base != null) && (base instanceof CClassInfo)) {
    String pkg = base.getOwnerPackage().name();
for (CElementInfo ei : model.getAllElements()) {
  getPackageContext(ei._package()).objectFactoryGenerator().populate(ei);
  codeModel._prepareModuleInfo(model.options.getModuleName(), JAXB_PACKAGE);
origin: com.legsem.legstar/legstar-jaxb-generator

      packageName, tempXsdFile.getAbsolutePath() });
  Model model = ModelLoader.load(options, new JCodeModel(),
      errorReceiver);
  if (model.generateCode(options, errorReceiver) == null) {
    throw new Cob2JaxbGeneratorException(
        "JAXB-XJC failed to compile a schema");
  model.codeModel.build(targetFolder);
  tempXsdFile.deleteOnExit();
} catch (IOException e) {
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc

/**
 * Generates an attribute wildcard property on a class.
 */
private void generateAttributeWildcard(ClassOutlineImpl cc) {
  String FIELD_NAME = "otherAttributes";
  String METHOD_SEED = model.getNameConverter().toClassName(FIELD_NAME);
  JClass mapType = codeModel.ref(Map.class).narrow(QName.class, String.class);
  JClass mapImpl = codeModel.ref(HashMap.class).narrow(QName.class, String.class);
  // [RESULT]
  // Map<QName,String> m = new HashMap<QName,String>();
  JFieldVar $ref = cc.implClass.field(JMod.PRIVATE,
      mapType, FIELD_NAME, JExpr._new(mapImpl));
  $ref.annotate2(XmlAnyAttributeWriter.class);
  MethodWriter writer = cc.createMethodWriter();
  JMethod $get = writer.declareMethod(mapType, "get" + METHOD_SEED);
  $get.javadoc().append(
      "Gets a map that contains attributes that aren't bound to any typed property on this class.\n\n"
      + "<p>\n"
      + "the map is keyed by the name of the attribute and \n"
      + "the value is the string value of the attribute.\n"
      + "\n"
      + "the map returned by this method is live, and you can add new attribute\n"
      + "by updating the map directly. Because of this design, there's no setter.\n");
  $get.javadoc().addReturn().append("always non-null");
  $get.body()._return($ref);
}
origin: sun-jaxb/jaxb-xjc

for( CEnumLeafInfo p : model.enums().values() )
  enums.put( p, generateEnumDef(p) );
for( CClassInfo bean : model.beans().values() )
  getClazz(bean);
  p.calcDefaultValues();
JClass OBJECT = codeModel.ref(Object.class);
  CClassInfo superClass = cc.target.getBaseClass();
  if(superClass!=null) {
    CClassRef refSuperClass = cc.target.getRefBaseClass();
    if(refSuperClass!=null) {
      cc.implClass._extends(refSuperClass.toType(this,EXPOSED));
for( CElementInfo ei : model.getAllElements())
  getPackageContext(ei._package()).objectFactoryGenerator().populate(ei);
origin: CodeFX-org/java-9-wtf

private void execute(String configuration) throws Exception {
  Options options = createOptions(configuration);
  Model model = ModelLoader.load(options, new JCodeModel(), ERROR_RECEIVER);
  Outline outline = model.generateCode(model.options, ERROR_RECEIVER);
  writeCode(outline);
}
origin: net.sourceforge.ccxjc/cc-xjc-plugin

 && field.getPropertyInfo().getAdapter().customType != null )
typeInfo = field.parent().parent().getModel().getTypeInfo(
  field.getPropertyInfo().getAdapter().customType );
  tryCopy._catch( field.parent().parent().getCodeModel().ref( Exception.class ) );
  ref( AssertionError.class ) ).arg( e ) );
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc

/**
 * 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);
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc

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;
}
com.sun.tools.xjc.modelModel

Javadoc

Root of the object model that represents the code that needs to be generated.

A Model is a schema language neutral representation of the result of a schema parsing. The back-end then works against this model to turn this into a series of Java source code.

Most used methods

  • generateCode
    Fully-generate the source code into the given model.
  • beans
  • getAllElements
  • getCustomizations
    Gets the global customizations.
  • getNameConverter
    Gets the name converter that shall be used to parse XML names into Java names.
  • enums
  • getElementMappings
  • getTypeInfo
  • <init>
  • add
  • getClassInfo
  • getNavigator
  • getClassInfo,
  • getNavigator,
  • getPackage,
  • isPackageLevelAnnotations,
  • setNameConverter,
  • setPackageLevelAnnotations,
  • typeUses,
  • getAttributeFormDefault,
  • getLocator

Popular in Java

  • Parsing JSON documents to java classes using gson
  • startActivity (Activity)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • getContentResolver (Context)
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now