コード例 #1
0
  /** Implementation for getting the indices of this class. i.e. <code>$a->foo[0]</code> */
  public Value __get(Env env, Value indexV) {
    if (indexV.isString()) {
      String name = indexV.toString();

      SimpleXMLElement attr = getAttribute(name);

      if (attr != null) return wrapJava(env, _cls, attr);
      else return NullValue.NULL;
    } else if (indexV.isLongConvertible()) {
      int i = indexV.toInt();

      if (i < _attributes.size()) return wrapJava(env, _cls, _attributes.get(i));

      return NullValue.NULL;
    } else return NullValue.NULL;
  }