public static FieldUpdater createFieldUpdater ( ObjectUpdater objUpdater , DBObject dbObj , String fieldName ) { if ( fieldName . charAt ( 0 ) == ' ' ) { if ( fieldName . equals ( CommonDefs . ID_FIELD ) ) { return new IDFieldUpdater ( objUpdater , dbObj ) ; } else { // Allow but skip all other system fields (e.g., "_table") return new NullFieldUpdater ( objUpdater , dbObj , fieldName ) ; } } TableDefinition tableDef = objUpdater . getTableDef ( ) ; if ( tableDef . isLinkField ( fieldName ) ) { return new LinkFieldUpdater ( objUpdater , dbObj , fieldName ) ; } else { Utils . require ( FieldDefinition . isValidFieldName ( fieldName ) , "Invalid field name: %s" , fieldName ) ; return new ScalarFieldUpdater ( objUpdater , dbObj , fieldName ) ; } }
Create a FieldUpdater that will handle updates for the given object and field .