public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWProperty.class);

    descriptor.addDirectMapping("key", "key/text()");
    descriptor.addDirectMapping("value", "value/text()");

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWRelationalProjectDefaultsPolicy.class);
    descriptor.getInheritancePolicy().setParentClass(MWTransactionalProjectDefaultsPolicy.class);

    descriptor.addDirectMapping("queriesCacheAllStatements", "cache-all-statements/text()");
    descriptor.addDirectMapping("queriesBindAllParameters", "bind-all-parameters/text()");

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(AbstractParticle.class);
    descriptor.getInheritancePolicy().setParentClass(AbstractSchemaComponent.class);

    ((XMLDirectMapping) descriptor.addDirectMapping("minOccurs", "min-occurs/text()"))
        .setNullValue(new Integer(1));
    ((XMLDirectMapping) descriptor.addDirectMapping("maxOccurs", "max-occurs/text()"))
        .setNullValue(new Integer(1));

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();

    descriptor.setJavaClass(MWReferenceHandle.class);

    descriptor.addDirectMapping(
        "referenceTableName",
        "getReferenceTableNameForTopLink",
        "setReferenceTableNameForTopLink",
        "reference-table-name/text()");
    descriptor.addDirectMapping(
        "referenceName",
        "getReferenceNameForTopLink",
        "setReferenceNameForTopLink",
        "reference-name/text()");

    return descriptor;
  }
  public static ClassDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();

    descriptor.setJavaClass(MWLoginSpecHandle.class);

    descriptor.addDirectMapping(
        "loginSpecName",
        "getLoginSpecNameForToplink",
        "setLoginSpecNameForToplink",
        "login-spec-name/text()");

    return descriptor;
  }
  // Persistence
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWLiteralArgument.class);
    descriptor.getInheritancePolicy().setParentClass(MWArgument.class);

    // 1:1 - type
    XMLCompositeObjectMapping typeMapping = new XMLCompositeObjectMapping();
    typeMapping.setAttributeName("type");
    typeMapping.setReferenceClass(MWTypeDeclaration.class);
    typeMapping.setXPath("type");
    descriptor.addMapping(typeMapping);

    // DTF Object value
    XMLDirectMapping valueMapping =
        (XMLDirectMapping) descriptor.addDirectMapping("value", "value/text()");
    valueMapping.setNullValue("");

    return descriptor;
  }
  public static XMLDescriptor legacy60BuildDescriptor() {
    XMLDescriptor descriptor = MWModel.legacy60BuildStandardDescriptor();

    descriptor.setJavaClass(MWTypeDeclaration.class);

    // 'type' will never be null
    XMLCompositeObjectMapping typeHandleMapping = new XMLCompositeObjectMapping();
    typeHandleMapping.setAttributeName("typeHandle");
    typeHandleMapping.setReferenceClass(MWClassHandle.class);
    typeHandleMapping.setGetMethodName("getTypeHandleForTopLink");
    typeHandleMapping.setSetMethodName("setTypeHandleForTopLink");
    typeHandleMapping.setXPath("type-handle");
    descriptor.addMapping(typeHandleMapping);

    XMLDirectMapping dimMapping =
        (XMLDirectMapping) descriptor.addDirectMapping("dimensionality", "dimensionality/text()");
    dimMapping.setNullValue(new Integer(0));

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();

    descriptor.setJavaClass(MWQueryableArgumentElement.class);

    XMLCompositeObjectMapping queryableHandleMapping = new XMLCompositeObjectMapping();
    queryableHandleMapping.setAttributeName("queryableHandle");
    queryableHandleMapping.setGetMethodName("getQueryableHandleForTopLink");
    queryableHandleMapping.setSetMethodName("setQueryableHandleForTopLink");
    queryableHandleMapping.setReferenceClass(MWQueryableHandle.class);
    queryableHandleMapping.setXPath("queryable-handle");
    descriptor.addMapping(queryableHandleMapping);

    ((XMLDirectMapping) descriptor.addDirectMapping("allowsNull", "allows-null/text()"))
        .setNullValue(Boolean.FALSE);

    XMLCompositeObjectMapping joinedQueryableElementMapping = new XMLCompositeObjectMapping();
    joinedQueryableElementMapping.setAttributeName("joinedQueryableElement");
    joinedQueryableElementMapping.setReferenceClass(MWQueryableArgumentElement.class);
    joinedQueryableElementMapping.setXPath("joined-queryable-element");
    descriptor.addMapping(joinedQueryableElementMapping);

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();

    descriptor.setJavaClass(MWEisLoginSpec.class);

    descriptor.addDirectMapping("name", "name/text()");

    descriptor.addDirectMapping(
        "j2cAdapterName",
        "getJ2CAdapterNameForTopLink",
        "setJ2CAdapterNameForTopLink",
        "j2c-adapter-name/text()");

    descriptor.addDirectMapping("userName", "user-name/text()");
    descriptor.addDirectMapping(
        "password", "getPasswordForTopLink", "setPasswordForTopLink", "password/text()");
    descriptor.addDirectMapping("connectionFactoryUrl", "connection-factory-url/text()");
    ((XMLDirectMapping) descriptor.addDirectMapping("savePassword", "save-password/text()"))
        .setNullValue(Boolean.FALSE);

    XMLCompositeObjectMapping connectionSpecClassHandleMapping = new XMLCompositeObjectMapping();
    connectionSpecClassHandleMapping.setAttributeName("connectionSpecClassHandle");
    connectionSpecClassHandleMapping.setGetMethodName("getConnectionSpecClassHandleForTopLink");
    connectionSpecClassHandleMapping.setSetMethodName("setConnectionSpecClassHandleForTopLink");
    connectionSpecClassHandleMapping.setReferenceClass(MWClassHandle.class);
    connectionSpecClassHandleMapping.setXPath("connection-spec-class-handle");
    descriptor.addMapping(connectionSpecClassHandleMapping);

    XMLCompositeCollectionMapping propertiesMapping = new XMLCompositeCollectionMapping();
    propertiesMapping.setReferenceClass(MWProperty.class);
    propertiesMapping.setAttributeName("properties");
    propertiesMapping.setGetMethodName("getPropertiesForTopLink");
    propertiesMapping.setSetMethodName("setPropertiesForTopLink");
    propertiesMapping.setXPath("property");
    descriptor.addMapping(propertiesMapping);

    return descriptor;
  }