Package anvil.script

Examples of anvil.script.Type


  }
 

  public Type lookupDeclaration(String name)
  {
    Type type = (Type)_types.get(name);
    if (type == null) {
      Namespace ns = _address.getZone().getNamespace(name);
      if (ns != null) {
        type = new NamespaceBase(this, name, ns, null);
      }
View Full Code Here


  }
 

  public final Any getType(Context context, String name)
  {
    Type type = (Type)_types.get(name);
    if (type != null) {
      return new AnyType(type);
    }
    throw context.NoSuchEntity(name + '@' + _name);
  }
View Full Code Here

    String classname = unserializer.getUTF16String();
    unserializer.consume('s');
    String pathinfo = unserializer.getUTF16String();
    Scope scope = context.import_(pathinfo);
    AnyClass self = null;
    Type type = anvil.script.Grammar.follow(scope, classname);
    if (type != null) {
      if (type.getType() == Type.CLASS) {
        self = ((ClassType)type).newInstance();
      }
    }
    if (self == null) {
      throw new UnserializationException("Couldn't create instance of '" + classname + "' at '" + pathinfo + "'");
View Full Code Here

 

  public Any getAttribute(Context context, String attribute)
  {
    Type type = _reflection.lookupDeclaration(attribute);
    if (type != null) {
      switch(type.getType()) {
      case Type.CONSTANT_VARIABLE:
      case Type.STATIC_VARIABLE:
        return ((VariableType)type).getValue();
      case Type.MEMBER_VARIABLE:
        return ((MemberVariableType)type).getValue(_object);
View Full Code Here

  }


  public Any setAttribute(Context context, String attribute, Any value)
  {
    Type type = _reflection.lookupDeclaration(attribute);
    if (type != null) {
      switch(type.getType()) {
      case Type.STATIC_VARIABLE:
        return ((VariableType)type).setValue(value);
      case Type.MEMBER_VARIABLE:
        return ((MemberVariableType)type).setValue(_object, value);
      }
View Full Code Here

      case Statement.ST_INTERFACE:
      case Statement.ST_NAMESPACE:
      case Statement.ST_FUNCTION:
        {
          DefinitionStatement defstmt = (DefinitionStatement)stmt;
          Type type = defstmt.lookupDeclaration(name);
          if (type != null) {
            return type;
          }
        }
        break;
View Full Code Here

    } catch (Throwable t) {
      anvil.Log.log().error("Class initialization failed: "+cls.getName(), t);
    }     

    int c = 0;
    Type type = parent;
    while(type != null) {
      if (type.getType() != CLASS) {
        break;
      }
      c++;
      type = type.getParent();
    }
   
    _parents = new ClassType[c];
    type = parent;
    for(int i=0; i<c; i++) {
      _parents[c-i-1] = (ClassType)type;
      type = type.getParent();
    }

    initializeMembers(classloader);
  }
View Full Code Here

  }


  public Type lookupDeclaration(String name)
  {
    Type type = (Type)_types.get(name);
    if (type == null) {
      type = lookupInheritedDeclaration(name);
    }
    return type;
  }
View Full Code Here

  }
 

  public Type getMember(Context context, String member)
  {
    Type type = (Type)_types.get(member);
    if (type != null && type.getType() == MEMBER_VARIABLE) {
      return type;
    }
    throw context.NoSuchEntity(_qname + '.' + member);
  }
View Full Code Here

  }


  public Any getMemberType(Context context, String member)
  {
    Type type = (Type)_types.get(member);
    if (type != null && type.getType() == MEMBER_VARIABLE) {
      return new AnyType(type);
    }
    throw context.NoSuchEntity(_qname + '.' + member);
  }
View Full Code Here

TOP

Related Classes of anvil.script.Type

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.