Package anvil.core

Examples of anvil.core.Any


  private ModificationItem buildItem(Any item)
  {
    if (item.isMap()) {
      AnyMap map = item.toMap();
      int modop = map.getLeft().toInt();
      Any right = map.getRight();
      if (right instanceof AnyAttribute) {
        Attribute attr = (Attribute)right.toObject();
        return new ModificationItem(modop, attr);
      }
    } else {
      if (item instanceof AnyAttribute) {
        Attribute attr = (Attribute)item.toObject();
View Full Code Here


    if (parameters.length < 1) {
      throw parametersMissing(context, "lookup");
    }
    Context ctx = getContext();
    try {
      Any param = parameters[0];
      if (param instanceof AnyName) {
        return Any.create(ctx.lookup((Name)param.toObject()));
      } else {
        return Any.create(ctx.lookup(param.toString()));
      }
    } catch (NamingException e) {
      throw context.exception(e);
    }
  }
View Full Code Here

    if (parameters.length < 1) {
      throw parametersMissing(context, "lookupLink");
    }
    Context ctx = getContext();
    try {
      Any param = parameters[0];
      if (param instanceof AnyName) {
        return Any.create(ctx.lookupLink((Name)param.toObject()));
      } else {
        return Any.create(ctx.lookupLink(param.toString()));
      }
    } catch (NamingException e) {
      throw context.exception(e);
    }
  }
View Full Code Here

    if (parameters.length < 1) {
      throw parametersMissing(context, "getNameParser");
    }
    Context ctx = getContext();
    try {
      Any param = parameters[0];
      if (param instanceof AnyName) {
        return new AnyNameParser(ctx.getNameParser((Name)param.toObject()));
      } else {
        return new AnyNameParser(ctx.getNameParser(param.toString()));
      }
    } catch (NamingException e) {
      throw context.exception(e);
    }
  }
View Full Code Here

  }

 
  public Any eval()
  {
    Any a = _left.eval();
    Any b = _right.eval();
    return a.concat(b);
  }
View Full Code Here

    if (parameters.length < 2) {
      throw parametersMissing(context, "parse");
    }
    Context ctx = getContext();
    try {
      Any param = parameters[0];
      String child = parameters[1].toString();
      AnyList list;
      if (param instanceof AnyName) {
        return new AnyName(ctx.getNameParser(
          (Name)param.toObject()).parse(child));
      } else {
        return new AnyName(ctx.getNameParser(
          param.toString()).parse(child));
      }
    } catch (NamingException e) {
      throw context.exception(e);
    }
  }
View Full Code Here

      throw parametersMissing(context, "compose");
    }
    Context ctx = getContext();
    try {
      String prefix = parameters[1].toString();
      Any param1 = parameters[0];
      Any param2 = parameters[1];
      if (param1 instanceof AnyName && param2 instanceof AnyName) {
        return new AnyName(ctx.composeName(
          (Name)param1.toObject(), (Name)param2.toObject()));
      } else {
        return Any.create(ctx.composeName(param1.toString(), param2.toString()));
      }
    } catch (NamingException e) {
      throw context.exception(e);
    }
  }
View Full Code Here

    if (parameters.length < 2) {
      throw parametersMissing(context, "bind");
    }
    Context ctx = getContext();

    Any param;
    Object value = parameters[1].toObject();
    Attributes attrs = null;

    if (parameters.length > 2) {
      param = parameters[2];
      if (param instanceof AnyAttributes) {
        attrs = (Attributes)param.toObject();
      }
    }

    try {
      if ((attrs != null) && (ctx instanceof DirContext)) {
        DirContext dirctx = (DirContext)ctx;
        param = parameters[0];
        if (param instanceof AnyName) {
          dirctx.bind((Name)param.toObject(), value, attrs);
        } else {
          dirctx.bind(param.toString(), value, attrs);
        }
        return this;
      }

      param = parameters[0];
      if (param instanceof AnyName) {
        ctx.bind((Name)param.toObject(), value);
      } else {
        ctx.bind(param.toString(), value);
      }
     
    } catch (NamingException e) {
      throw context.exception(e);
    }
View Full Code Here

    if (parameters.length < 2) {
      throw parametersMissing(context, "rebind");
    }
    Context ctx = getContext();

    Any param;
    Object value = parameters[1].toObject();
    Attributes attrs = null;

    if (parameters.length > 2) {
      param = parameters[2];
      if (param instanceof AnyAttributes) {
        attrs = (Attributes)param.toObject();
      }
    }

    try {
      if ((attrs != null) && (ctx instanceof DirContext)) {
        DirContext dirctx = (DirContext)ctx;
        param = parameters[0];
        if (param instanceof AnyName) {
          dirctx.rebind((Name)param.toObject(), value, attrs);
        } else {
          dirctx.rebind(param.toString(), value, attrs);
        }
        return this;
      }

      param = parameters[0];
      if (param instanceof AnyName) {
        ctx.rebind((Name)param.toObject(), value);
      } else {
        ctx.rebind(param.toString(), value);
      }
     
    } catch (NamingException e) {
      throw context.exception(e);
    }
View Full Code Here

    if (parameters.length < 1) {
      throw parametersMissing(context, "unbind");
    }
    Context ctx = getContext();
    try {
      Any param = parameters[0];
      if (param instanceof AnyName) {
        ctx.unbind((Name)param.toObject());
      } else {
        ctx.unbind(param.toString());
      }
    } catch (NamingException e) {
      throw context.exception(e);
    }
    return this;
View Full Code Here

TOP

Related Classes of anvil.core.Any

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.