Package org.apache.uima.util

Examples of org.apache.uima.util.NameClassPair


          Class propClass = props[i].getPropertyType();
          // translate primitive types (int, boolean, etc.) to wrapper classes
          if (propClass.isPrimitive()) {
            propClass = getWrapperClass(propClass);
          }
          resultList.add(new NameClassPair(propName, propClass.getName()));
        }
      }
      return resultList;
    } catch (IntrospectionException e) {
      throw new UIMARuntimeException(e);
View Full Code Here


  public Class getAttributeClass(String aName) {
    try {
      List attrList = listAttributes();
      Iterator it = attrList.iterator();
      while (it.hasNext()) {
        NameClassPair ncp = (NameClassPair) it.next();
        if (ncp.getName().equals(aName)) {
          return Class.forName(ncp.getClassName());
        }
      }
      return null;
    } catch (Exception e) {
      throw new UIMARuntimeException(e);
View Full Code Here

    StringBuffer buf = new StringBuffer();
    buf.append(getClass().getName()).append(": \n");
    List attrList = listAttributes();
    Iterator i = attrList.iterator();
    while (i.hasNext()) {
      NameClassPair ncp = (NameClassPair) i.next();
      buf.append(ncp.getName() + " = ");
      Object val = getAttributeValue(ncp.getName());
      if (val == null)
        buf.append("NULL");
      else if (val instanceof Object[]) {
        Object[] array = (Object[]) val;
        buf.append("Array{");
View Full Code Here

      return false;
    }
    // iterate through all attributes in this object
    Iterator i = theseAttrs.iterator();
    while (i.hasNext()) {
      NameClassPair ncp = (NameClassPair) i.next();
      // other object must contain this attribute
      if (!thoseAttrs.contains(ncp)) {
        return false;
      }
      // get values and test equivalency
      Object val1 = this.getAttributeValue(ncp.getName());
      Object val2 = mdo.getAttributeValue(ncp.getName());
      if (val1 == null) {
        if (val2 != null)
          return false;
      } else if (val1 instanceof Object[]) {
        if (!(val2 instanceof Object[]))
View Full Code Here

          Class propClass = props[i].getPropertyType();
          // translate primitive types (int, boolean, etc.) to wrapper classes
          if (propClass.isPrimitive()) {
            propClass = getWrapperClass(propClass);
          }
          resultList.add(new NameClassPair(propName, propClass.getName()));
        }
      }
      return resultList;
    } catch (IntrospectionException e) {
      throw new UIMARuntimeException(e);
View Full Code Here

    StringBuffer buf = new StringBuffer();
    buf.append(getClass().getName()).append(": \n");
    List<NameClassPair> attrList = listAttributes();
    Iterator<NameClassPair> i = attrList.iterator();
    while (i.hasNext()) {
      NameClassPair ncp = (NameClassPair) i.next();
      buf.append(ncp.getName() + " = ");
      Object val = getAttributeValue(ncp.getName());
      if (val == null)
        buf.append("NULL");
      else if (val instanceof Object[]) {
        Object[] array = (Object[]) val;
        buf.append("Array{");
View Full Code Here

      return false;
    }
    // iterate through all attributes in this object
    Iterator<NameClassPair> i = theseAttrs.iterator();
    while (i.hasNext()) {
      NameClassPair ncp = i.next();
      // other object must contain this attribute
      if (!thoseAttrs.contains(ncp)) {
        return false;
      }
      // get values and test equivalency
      Object val1 = this.getAttributeValue(ncp.getName());
      Object val2 = mdo.getAttributeValue(ncp.getName());
      if (!valuesEqual(val1, val2)) {
        return false;
      }
    }
    // if we get this far, objects are equal
View Full Code Here

   *
   * @see org.apache.uima.resource.MetaDataObject#listAttributes()
   */
  public List<NameClassPair> listAttributes() {
    List<NameClassPair> result = super.listAttributes();
    result.add(new NameClassPair(PROP_DELEGATE_ANALYSIS_ENGINE_SPECIFIERS_WITH_IMPORTS, Map.class
            .getName()));
    return result;
  }
View Full Code Here

   * For testing purposes - a hardcoded attribute set. Should be compared with the results of
   * {@link #listAttributes()}.
   */
  static public Set<NameClassPair> getAttributeSet() {
    Set<NameClassPair> result = new HashSet<NameClassPair>();
    result.add(new NameClassPair("fruits", TestFruitObject[].class.getName()));
    return result;
  }
View Full Code Here

   * For testing purposes - a hardcoded attribute set. Should be compared with the results of
   * {@link #listAttributes()}.
   */
  static public Set<NameClassPair> getAttributeSet() {
    HashSet<NameClassPair> result = new HashSet<NameClassPair>();
    result.add(new NameClassPair("name", String.class.getName()));
    result.add(new NameClassPair("color", String.class.getName()));
    result.add(new NameClassPair("avgWeightLbs", Float.class.getName()));
    result.add(new NameClassPair("avgCostCents", Integer.class.getName()));
    result.add(new NameClassPair("citrus", Boolean.class.getName()));
    result.add(new NameClassPair("commonUses", String[].class.getName()));
    return result;
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.util.NameClassPair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.