Examples of TypeDescriptor


Examples of net.sourceforge.javautil.bytecode.api.TypeDescriptor

    context.getTarget().visitMethodInsn(opcode, method.getDeclaringType().getType().getName(), method.getName(), desc);
   
    if (opcode != Opcodes.INVOKESTATIC) context.popStack();
    for (int i=0; i<method.getDescriptor().getParameters().length; i++) context.popStack();
   
    TypeDescriptor rt = method.getDescriptor().getReturnType();
    if (rt != null && rt != TypeDescriptor.VOID) context.push(rt);
  }
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.TypeDescriptor

   */
  protected void setValue (String name, Object value) {
    if (value == null) throw new IllegalArgumentException("Annotation values cannot be null");
    if (!this.methods.containsKey(name)) throw new IllegalArgumentException("No such annotation value named: " + name + " for " + type);
   
    TypeDescriptor type = this.methods.get(name).getDescriptor().getReturnType();
    TypeDescriptor pt = TypeDescriptor.getFor(value.getClass());
   
    if (type.compareTo(pt) != 0) {
      if (pt.isArray() && type.compareTo(pt.getComponentType()) == 0) {
        value = Array.get(value, 0);
      } else if (type.isArray() && pt.compareTo(type.getComponentType()) == 0) {
        Object array = Array.newInstance(value.getClass(), 1);
        Array.set(array, 0, value);
        value = array;
      } else {
        throw new IllegalArgumentException(value + " is not of the expected annotation value type: " + type);
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.TypeDescriptor

    super(descriptor);
    this.value = value;
  }

  public void load(BytecodeContextMethod context) {
    TypeDescriptor top = this.value.getType();
   
    if (top.isPrimitive() && descriptor.compareTo( TypeDescriptor.getFor(Object.class) ) == 0) {

      context.invoke(context.getResolutionPool().resolve(top.getBoxedType().getClassName()), "valueOf", this.value);

    } else if (descriptor.isPrimitive() && !top.isPrimitive()) {
     
      String methodName = null;

      if (descriptor == TypeDescriptor.INTEGER) { methodName = "intValue"; }
      else if (descriptor == TypeDescriptor.LONG) { methodName = "longValue"; }
      else if (descriptor == TypeDescriptor.SHORT) { methodName = "shortValue"; }
      else if (descriptor == TypeDescriptor.CHAR) { methodName = "charValue"; }
      else if (descriptor == TypeDescriptor.DOUBLE) { methodName = "doubleValue"; }
      else if (descriptor == TypeDescriptor.FLOAT) { methodName = "floatValue"; }
      else if (descriptor == TypeDescriptor.BOOLEAN) { methodName = "booleanValue"; }
      else if (descriptor == TypeDescriptor.BYTE) { methodName = "byteValue"; }
     
      context.invoke(context.createCast(descriptor.getBoxedType(), value), methodName);
     
    } else if (top.isPrimitive() && descriptor.isPrimitive()) {
     
      if (top != descriptor) {
       
      } else {
        value.load(context);
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.TypeDescriptor

  /**
   * @param type The type to pop
   * @return The popped type if verified, otherwise throws an exception
   */
  public TypeDescriptor pop (TypeDescriptor type) {
    TypeDescriptor removed = this.stack.remove(0);
    if (!removed.equals(type)) throw new BytecodeException("Type removed from stack inconsistent: " + type.toDescriptorString() + ", expected: " + removed.toDescriptorString());
    return removed;
  }
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.TypeDescriptor

   * @param indices The indices for the matrix point to load
   */
  public void get (IBytecodeReferenceable array, IBytecodeReferenceable... indices) {
    array.load(this);
   
    TypeDescriptor type = array.getType();
   
    for (int i=0; i<indices.length; i++) {
      indices[i].load(this);
      writer.arrayLoad(this, type);
      type = type.getComponentType();
    }
  }
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.TypeDescriptor

   * @param indices The set matrix point
   */
  public void setArrayIndexValue (IBytecodeReferenceable array, IBytecodeReferenceable value, IBytecodeReferenceable... indices) {
    array.load(this);
   
    TypeDescriptor type = array.getType();
   
    int load = indices.length - 1;
    for (int i=0; i<load; i++) {
      indices[i].load(this);
      writer.arrayLoad(this, type);
      type = type.getComponentType();
    }
   
    indices[load].load(this);
    if (value == null) loadNull(); else value.load(this);
    writer.arrayStore(this);
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.TypeDescriptor

 
  /**
   * @param referenceable The value to return
   */
  public void returnValue (IBytecodeReferenceable expression) {
    TypeDescriptor expectedReturnType = method.getDescriptor().getReturnType();
    if (expectedReturnType == null || expectedReturnType == TypeDescriptor.VOID) {
      if (expression != null) expression.load(this);
      this.returnVoid();
    } else {
      if (expression == null) this.returnNull();
View Full Code Here

Examples of net.sourceforge.javautil.bytecode.api.TypeDescriptor

           
            return ArgumentMatch.NONE;
          }
        } else if (parameterTypes[p].getType().isPrimitive()) {
         
          TypeDescriptor ptype = parameterTypes[p].getType();
          if (ptype == arguments[p]) { matched++; continue; }
         
          if (ptype.isPrimitive() && arguments[p].getClassName().equals(ptype.getBoxedType())) {
           
            matched++; continue;
           
          } else return ArgumentMatch.NONE;
         
View Full Code Here

Examples of org.apache.derby.catalog.TypeDescriptor

       
        AliasDescriptor ad = DataDictionaryImpl.SYSFUN_AD[f];
        if (ad == null)
        {
          // details[1] Return type
          TypeDescriptor rt =
            DataTypeDescriptor.getBuiltInDataTypeDescriptor(details[1]);

          // details[4] - zero or single argument type
          String paramType = details[4];
          TypeDescriptor[] pt;
View Full Code Here

Examples of org.apache.derby.catalog.TypeDescriptor

    TransactionController   tc)
        throws StandardException
    {
        // Safe to re-use a TypeDescriptor here as they are
        // not modified during the creation of the routine
        TypeDescriptor varchar128 =
            DataTypeDescriptor.getBuiltInDataTypeDescriptor(
                    Types.VARCHAR, 128);

        UUID  sysUtilUUID = getSystemUtilSchemaDescriptor().getUUID();
        /* SYSCS_EXPORT_TABLE_LOBS_TO_EXTFILE(IN SCHEMANAME  VARCHAR(128),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.