Exemple #1
0
  /**
   * Returns true if any of the fields associated with the given XMLClassDescriptor are located at,
   * or beneath, the given location.
   *
   * @param location the location to compare against
   * @param classDesc the XMLClassDescriptor in which to check the field locations
   * @return true if any of the fields has a location associated
   */
  static final boolean hasFieldsAtLocation(
      final String location, final XMLClassDescriptor classDesc) {
    // -- check elements
    XMLFieldDescriptor[] descriptors = classDesc.getElementDescriptors();
    for (int i = 0; i < descriptors.length; i++) {
      if (descriptors[i] == null) {
        continue;
      }
      String tmpLocation = descriptors[i].getLocationPath();
      if ((tmpLocation != null) && (tmpLocation.startsWith(location))) {
        return true;
      }
    }

    // -- check attributes
    descriptors = classDesc.getAttributeDescriptors();
    for (int i = 0; i < descriptors.length; i++) {
      if (descriptors[i] == null) {
        continue;
      }
      String tmpLocation = descriptors[i].getLocationPath();
      if ((tmpLocation != null) && (tmpLocation.startsWith(location))) {
        return true;
      }
    }

    // -- check content/text
    XMLFieldDescriptor content = classDesc.getContentDescriptor();
    if (content != null) {
      String tmpLocation = content.getLocationPath();
      if ((tmpLocation != null) && (tmpLocation.startsWith(location))) {
        return true;
      }
    }
    return false;
  } // -- hasFieldsAtLocation
Exemple #2
0
 /**
  * Returns the XMLFieldDescriptor for the member that should be marshalled as text content.
  *
  * @return the XMLFieldDescriptor for the member that should be marshalled as text content.
  */
 public XMLFieldDescriptor getContentDescriptor() {
   return _classDesc.getContentDescriptor();
 } // -- getContentDescriptor