Add a constant to this class.

@param FieldDoc field
436836
public function addConstant(&$constant)
    {
        if (!isset($this->_constants[$constant->name()])) {
            $this->_constants[$constant->name()] =& $constant;
        }
    }
858091
public ConstantMethodInfo addConstantMethod(String className,
                                                String methodName,
                                                TypeDesc ret,
                                                TypeDesc[] params) {
        
        MethodDesc md = MethodDesc.forArguments(ret, params);
        ConstantInfo ci = new ConstantMethodInfo
            (addConstantClass(className), addConstantNameAndType(methodName, md));
        return (ConstantMethodInfo)addConstant(ci);
    }
1298986
@SuppressWarnings("unchecked")
  public static void addAnnotation(Field field, Annotation annotation) {
    field.getAnnotation(Annotation.class);// prevent declaredAnnotations haven't initialized
    Map<Class<? extends Annotation>, Annotation> annos;
    try {
      annos = (Map<Class<? extends Annotation>, Annotation>) Field_Field_DeclaredAnnotations.get(field);
    } catch (IllegalAccessException e) {
      throw new IllegalStateException(e);
    }
    if (annos.getClass() == Collections.EMPTY_MAP.getClass()) {
      annos = new HashMap<>();
      try {
        Field_Field_DeclaredAnnotations.set(field, annos);
      } catch (IllegalAccessException e) {
        throw new IllegalStateException(e);
      }
    }
    annos.put(annotation.annotationType(), annotation);
  }
46734
public void storeField(String fieldName,
                           TypeDesc type) {

        putfield(-1, Opcode.PUTFIELD, constantField(fieldName, type), type);
    }
1095167
public void addField(String scope, String type, String name, String defaultValue) {
        fields.put(name, new FieldCode(scope, name, type, defaultValue));
    }
1287213
public void addMultiValuedField(String fieldName, List<String> values) {

        if ((values != null) && (values.size() > 0)) {
            for (String value : values) {
                m_doc.addField(fieldName, value);
            }
        }
    }
689328
private void addFieldToDocument(Object object, Document document, java.lang.reflect.Field field, String colName,
        String indexName) {
        try {
            Object obj = PropertyAccessorHelper.getObject(object, field);
            // String str =
            // String value = (obj == null) ? null : obj.toString();
            if (obj != null) {
                Field luceneField =
                    new Field(getCannonicalPropertyName(indexName, colName), obj.toString(), Field.Store.YES,
                        Field.Index.ANALYZED_NO_NORMS);

                document.add(luceneField);
            } else {
                LOG.warn("value is null for field" + field.getName());
            }
        } catch (PropertyAccessException e) {
            LOG.error("Error in accessing field, Caused by:" + e.getMessage());
            throw new LuceneIndexingException("Error in accessing field:" + field.getName(), e);
        }
    }
470309
public void addAnnotation(final Class<? extends Annotation> clazz) {
        if (field.isAnnotationPresent(clazz)) {
            addAnnotation(clazz, field.getAnnotation(clazz));
        }
    }
1291087
@Override
    public void addValuesForField() {
        FieldDefinition fieldDef = m_tableDef.getFieldDef(m_fieldName);
        if (fieldDef == null || !fieldDef.isCollection()) {
            addSVScalar();
        } else {
            addMVScalar();
        }
    }
137434
private void addPropertyName(Document doc, InternalQName name) throws RepositoryException
   {
      String fieldName = name.getName();
      try
      {
         fieldName = resolver.createJCRName(name).getAsString();
      }
      catch (NamespaceException e)
      {
         // will never happen
         if (LOG.isTraceEnabled())
         {
            LOG.trace("An exception occurred: " + e.getMessage());
         }
      }
      doc.add(new Field(FieldNames.PROPERTIES_SET, fieldName, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
   }
1095902
public void addFieldLine(String className, String fieldName, SourceLineRange range) {
        fieldLineMap.put(new FieldDescriptor(className, fieldName), range);
    }
1224484
public void addClassDoc(ClassDoc classdoc) {
        if (classdoc == null) {
            return;
        }
        addClass(classdoc, allClasses);
        if (classdoc.isOrdinaryClass()) {
            addClass(classdoc, ordinaryClasses);
        } else if (classdoc.isException()) {
            addClass(classdoc, exceptions);
        } else if (classdoc.isEnum()) {
            addClass(classdoc, enums);
        } else if (classdoc.isAnnotationType()) {
            addClass(classdoc, annotationTypes);
        } else if (classdoc.isError()) {
            addClass(classdoc, errors);
        } else if (classdoc.isInterface()) {
            addClass(classdoc, interfaces);
        }
    }
27097
@SuppressWarnings("unchecked")
    public void addDoc(Map<String, Object> jsonFields, String collName,
            String docId) {
        if (!mCollections.containsKey(collName)) {
            // add new collection
            log.debug("Added collection " + collName);
            mCollections.put(collName, new ConcurrentHashMap<String, Map<String,Object>>());
        }
        Map<String, Map<String,Object>> collection = mCollections.get(collName);

        Map<String, Object> fields;

        if(jsonFields.get(DdpMessageField.FIELDS) == null) {
            fields = new ConcurrentHashMap<>();
        } else {
            fields = (Map<String, Object>) jsonFields.get(DdpMessageField.FIELDS);
        }

        collection.put(docId, fields);

        if (BuildConfig.DEBUG) {
            log.debug("Added docid " + docId + " to collection " + collName);
        }
    }
1232598
private void addConstantMember(FieldDoc member, HtmlTree trTree) {
        trTree.addContent(getTypeColumn(member));
        trTree.addContent(getNameColumn(member));
        trTree.addContent(getValue(member));
    }
365967
@Nonnull
    public BugInstance addField(String className, String fieldName, String fieldSig, boolean isStatic) {
        addField(new FieldAnnotation(className, fieldName, fieldSig, isStatic));
        return this;
    }
1064804
public void add(String fldName, Schema sch) {
		Type type = sch.type(fldName);
		addField(fldName, type);
	}
567596
private boolean hasConstantField (ClassDoc classDoc) {
        VisibleMemberMap visibleMemberMapFields = new VisibleMemberMap(classDoc,
            VisibleMemberMap.FIELDS, configuration);
        List<?> fields = visibleMemberMapFields.getLeafClassMembers(configuration);
        for (Iterator<?> iter = fields.iterator(); iter.hasNext(); ) {
            FieldDoc field = (FieldDoc) iter.next();
            if (field.constantValueExpression() != null) {
                classDocsWithConstFields.add(classDoc);
                return true;
            }
        }
        return false;
    }