/** * Remove a field from this class. After this method, the removed field * will be invalid, and the result of any operations on it is undefined. * * @return true if this class contained the field, false otherwise */ public boolean removeDeclaredField(BCField field) { if (field == null) return false; return removeDeclaredField(field.getName()); }
public void enterBCField(BCField obj) { openBlock("Field"); println("access=" + obj.getAccessFlags()); println("name=" + obj.getNameIndex() + " <" + obj.getName() + ">"); println("type=" + obj.getDescriptorIndex() + " <" + obj.getTypeName() + ">"); }
/** * Return all fields with the given name, including those of all * superclasses, or an empty array if none. */ public BCField[] getFields(String name) { List matches = new LinkedList(); BCField[] fields = getFields(); for (int i = 0; i < fields.length; i++) if (fields[i].getName().equals(name)) matches.add(fields[i]); return (BCField[]) matches.toArray(new BCField[matches.size()]); }
public void enterBCField(BCField obj) { openBlock("Field"); println("access=" + obj.getAccessFlags()); println("name=" + obj.getNameIndex() + " <" + obj.getName() + ">"); println("type=" + obj.getDescriptorIndex() + " <" + obj.getTypeName() + ">"); }
private void registerBackingFieldInfo(FieldMetaData fmd, BCMethod method, BCField field) { if (_backingFields == null) _backingFields = new HashMap(); _backingFields.put(method.getName(), field.getName()); if (_attrsToFields == null) _attrsToFields = new HashMap(); _attrsToFields.put(fmd.getName(), field.getName()); if (_fieldsToAttrs == null) _fieldsToAttrs = new HashMap(); _fieldsToAttrs.put(field.getName(), fmd.getName()); }
private void registerBackingFieldInfo(FieldMetaData fmd, BCMethod method, BCField field) { if (_backingFields == null) _backingFields = new HashMap(); _backingFields.put(method.getName(), field.getName()); if (_attrsToFields == null) _attrsToFields = new HashMap(); _attrsToFields.put(fmd.getName(), field.getName()); if (_fieldsToAttrs == null) _fieldsToAttrs = new HashMap(); _fieldsToAttrs.put(field.getName(), fmd.getName()); }
/** * Return the declared field with the given name, or null if none. */ public BCField getDeclaredField(String name) { BCField[] fields = getDeclaredFields(); for (int i = 0; i < fields.length; i++) if (fields[i].getName().equals(name)) return fields[i]; return null; }
/** * Return the declared field with the given name, or null if none. */ public BCField getDeclaredField(String name) { BCField[] fields = getDeclaredFields(); for (int i = 0; i < fields.length; i++) if (fields[i].getName().equals(name)) return fields[i]; return null; }
/** * Return all fields with the given name, including those of all * superclasses, or an empty array if none. */ public BCField[] getFields(String name) { List matches = new LinkedList(); BCField[] fields = getFields(); for (int i = 0; i < fields.length; i++) if (fields[i].getName().equals(name)) matches.add(fields[i]); return (BCField[]) matches.toArray(new BCField[matches.size()]); }
/** * Remove a field from this class. After this method, the removed field * will be invalid, and the result of any operations on it is undefined. * * @return true if this class contained the field, false otherwise */ public boolean removeDeclaredField(BCField field) { if (field == null) return false; return removeDeclaredField(field.getName()); }
private void registerBackingFieldInfo(FieldMetaData fmd, BCMethod method, BCField field) { if (_backingFields == null) _backingFields = new HashMap(); _backingFields.put(method.getName(), field.getName()); if (_attrsToFields == null) _attrsToFields = new HashMap(); _attrsToFields.put(fmd.getName(), field.getName()); if (_fieldsToAttrs == null) _fieldsToAttrs = new HashMap(); _fieldsToAttrs.put(field.getName(), fmd.getName()); }
private void registerBackingFieldInfo(FieldMetaData fmd, BCMethod method, BCField field) { if (_backingFields == null) _backingFields = new HashMap(); _backingFields.put(method.getName(), field.getName()); if (_attrsToFields == null) _attrsToFields = new HashMap(); _attrsToFields.put(fmd.getName(), field.getName()); if (_fieldsToAttrs == null) _fieldsToAttrs = new HashMap(); _fieldsToAttrs.put(field.getName(), fmd.getName()); }
private void registerBackingFieldInfo(FieldMetaData fmd, BCMethod method, BCField field) { if (_backingFields == null) _backingFields = new HashMap(); _backingFields.put(method.getName(), field.getName()); if (_attrsToFields == null) _attrsToFields = new HashMap(); _attrsToFields.put(fmd.getName(), field.getName()); if (_fieldsToAttrs == null) _fieldsToAttrs = new HashMap(); _fieldsToAttrs.put(field.getName(), fmd.getName()); }
/** * Remove a field from this class. After this method, the removed field * will be invalid, and the result of any operations on it is undefined. * * @return true if this class contained the field, false otherwise */ public boolean removeDeclaredField(String name) { List fields = _state.getFieldsHolder(); BCField field; for (Iterator itr = fields.iterator(); itr.hasNext();) { field = (BCField) itr.next(); if (field.getName().equals(name)) { itr.remove(); field.invalidate(); return true; } } return false; }
/** * Remove a field from this class. After this method, the removed field * will be invalid, and the result of any operations on it is undefined. * * @return true if this class contained the field, false otherwise */ public boolean removeDeclaredField(String name) { List fields = _state.getFieldsHolder(); BCField field; for (Iterator itr = fields.iterator(); itr.hasNext();) { field = (BCField) itr.next(); if (field.getName().equals(name)) { itr.remove(); field.invalidate(); return true; } } return false; }
/** * Set the field this instruction operates on. * * @return this instruction, for method chaining */ public FieldInstruction setField(BCField field) { if (field == null) return setFieldIndex(0); return setField(field.getDeclarer().getName(), field.getName(), field.getTypeName()); }
/** * Set the field this instruction operates on. * * @return this instruction, for method chaining */ public FieldInstruction setField(BCField field) { if (field == null) return setFieldIndex(0); return setField(field.getDeclarer().getName(), field.getName(), field.getTypeName()); }
/** * Import the information from given field as a new field in this class. * * @return the added field */ public BCField declareField(BCField field) { BCField newField = declareField(field.getName(), field.getTypeName()); newField.setAccessFlags(field.getAccessFlags()); newField.setAttributes(field.getAttributes()); return newField; }
/** * Import the information from given field as a new field in this class. * * @return the added field */ public BCField declareField(BCField field) { BCField newField = declareField(field.getName(), field.getTypeName()); newField.setAccessFlags(field.getAccessFlags()); newField.setAttributes(field.getAttributes()); return newField; }
/** * Write unmanaged fields to the stream (pcWriteUnmanaged). */ private void addWriteUnmanaged(Collection unmgd, boolean parentDetachable) throws NoSuchMethodException { Class[] outargs = new Class[]{ ObjectOutput.class }; BCMethod meth = _pc.declareMethod(PRE + "WriteUnmanaged", void.class, outargs); meth.makeProtected(); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); Code code = meth.getCode(true); // super.writeUnmanaged (out); if (parentDetachable) { loadManagedInstance(code, false); code.aload().setParam(0); code.invokespecial().setMethod(getType(_meta. getPCSuperclassMetaData()), PRE + "WriteUnmanaged", void.class, outargs); } // write declared unmanaged serializable fields BCField field; for (Iterator itr = unmgd.iterator(); itr.hasNext();) { field = (BCField) itr.next(); writeExternal(code, field.getName(), field.getType(), null); } code.vreturn(); code.calculateMaxStack(); code.calculateMaxLocals(); }