Package net.sf.rej.java

Examples of net.sf.rej.java.Field


                sd.drawDefault("{");
            }
        } else if (er instanceof FieldDefRow) {
            FieldDefRow fdr = (FieldDefRow)er;
            Field f = fdr.getField();
        FieldSignature fieldSig = null;
            boolean displayGenerics = SystemFacade.getInstance().getPreferences().isSettingTrue(Settings.DISPLAY_GENERICS);
            if (displayGenerics) {
              SignatureAttribute signature = f.getAttributes().getSignatureAttribute();
              if (signature != null) {
                fieldSig = Signatures.getFieldSignature(signature.getSignatureString());
              }
            }

            sd.drawIndent();
            String access = f.getAccessString();
            if (access.length() > 0) {
                sd.drawKeyword(access + " ");
            }
            JavaType ret = f.getDescriptor().getReturn();
            if (fieldSig == null) {
              if (ret.isPrimitive()) {
                sd.drawKeyword(ret.getType());
              } else {
                sd.drawDefault(ia.getShortName(ret.getType()));
              }
              sd.drawDefault(ret.getDimensions());
            } else {
              renderGenericJavaType(sd, ia, fieldSig.getType());
            }
           
          sd.drawDefault(" ");

            sd.drawField(f.getName());
            ConstantPoolInfo constant = f.getConstant();
            if (constant != null) {
              sd.drawDefault(" = ");
              drawConstant(sd, constant);
            }
            sd.drawDefault(";");
View Full Code Here


        this.rows.add(fadr);
      }
       */

      FieldDefRow fdr = null;
      Field field = fieldsA.get(fieldSignature);
      if (field == null) {
        field = fieldsB.get(fieldSignature);
        fdr = new FieldDefRow(cfB, field);
        this.rowsB.add(fdr);
      } else {
View Full Code Here

  public void refresh() {
    this.fields = new ArrayList<FieldNode>();
    List list = this.cf.getFields();
    for (int i = 0; i < list.size(); i++) {
      Field field = (Field) list.get(i);
      FieldNode fieldNode = new FieldNode(this.cf, field);
      fieldNode.setParent(this);
      this.fields.add(fieldNode);
    }
  }
View Full Code Here

            // cf will be null if referenced class is not in project classpath
            if (cf != null) {
                List fields = cf.getFields();
                for (int i = 0; i < fields.size(); i++) {
                    Field field = (Field)fields.get(i);
                    Wrapper<Field> wrapper = new Wrapper<Field>();
                    wrapper.setContent(field);
                    wrapper.setDisplay(field.getSignatureLine());
                    this.fieldModel.addElement(wrapper);
                }
            }

        } catch (Exception e) {
View Full Code Here

      ClassIndex ci = SystemFacade.getInstance().getClassIndex();
      ClassLocator cl = ci.getLocator(className);
      if (cl != null && cl.getFileSet().equals(this.openProject.getFileSet())) {
        ClassFile cf = SystemFacade.getInstance().getClassFile(cl);
        List fields = cf.getFields();
        Field field = null;
        for (int i = 0; i < fields.size(); i++) {
          Field f = (Field) fields.get(i);
          if (f.getName().equals(fieldName)
              && f.getDescriptor().equals(desc)) {
            field = f;
            break;
          }
        }
View Full Code Here

    this.rows.add(new BlankRow());

    // Fields
    java.util.List fields = cf.getFields();
    for (int i = 0; i < fields.size(); i++) {
      Field field = (Field) fields.get(i);

      // Field annotations
      RuntimeInvisibleAnnotationsAttribute fieldAnnInvisible = field
          .getAttributes().getRuntimeInvisibleAnnotationsAttribute();
      RuntimeVisibleAnnotationsAttribute fieldAnnVisible = field
          .getAttributes().getRuntimeVisibleAnnotationsAttribute();
      List<Annotation> fieldAnnotations = new ArrayList<Annotation>();
      if (fieldAnnInvisible != null) {
        fieldAnnotations.addAll(fieldAnnInvisible.getAnnotations());
      }
View Full Code Here

            methodEditor.getExceptions());
      }

    } else if (o instanceof FieldDefRow) {
      FieldDefRow fdr = (FieldDefRow) o;
      Field field = fdr.getField();
      int flags = field.getAccessFlags();
      this.fieldEditor.invoke(field.getName(), field.getDescriptor(),
          flags);

      if (!this.fieldEditor.wasCancelled()) {
        AccessFlags af = this.fieldEditor.getAccessFlags();
        String name = this.fieldEditor.getFieldName();
View Full Code Here

          transferables.add(transferrable);
        }

      } else if (obj instanceof FieldDefRow) {
        FieldDefRow fdr = (FieldDefRow) obj;
        Field field = fdr.getField();
        // TODO: Attributes are not being copied

        TransferrableField transferrable = new TransferrableField();
        transferrable.setFieldName(field.getName());
        transferrable.setDescriptor(field.getDescriptor());
        transferrable.setAccessFlags(field.getAccessFlags());
        transferables.add(transferrable);
      } else if (obj instanceof CodeRow || obj instanceof LabelRow) {
        code.add((EditorRow) obj);
      }
    }
View Full Code Here

      ClassFile cf = factory.createClass(rt.name(), superClass);
      ConstantPool cp = cf.getPool();
      FieldFactory fieldFactory = new FieldFactory();
      for (IField field : rt.visibleFields()) {
        AccessFlags flags = new AccessFlags(field.modifiers());
        Field fieldToAdd = fieldFactory.createField(cf, flags, cp.optionalAddUtf8(field.name()), cp.optionalAddUtf8(field.signature()));
        cf.add(fieldToAdd);
      }
     
      MethodFactory methodFactory = new MethodFactory();
      for (IMethod method : rt.visibleMethods()) {
View Full Code Here

TOP

Related Classes of net.sf.rej.java.Field

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.