001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache license, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the license for the specific language governing permissions and
015 * limitations under the license.
016 */
017 package org.apache.logging.log4j.nosql.appender;
018
019 /**
020 * Represents a simple POJO object inserted into a NoSQL object.
021 *
022 * @param <W> Specifies what type of underlying object (such as a MongoDB BasicDBObject) this NoSqlObject wraps.
023 */
024 public interface NoSqlObject<W> {
025 /**
026 * Sets the value of a property on this object to a String or primitive.
027 *
028 * @param field The name of the property
029 * @param value The value of the property
030 */
031 void set(String field, Object value);
032
033 /**
034 * Sets the value of a property on this object to a nested complex object.
035 *
036 * @param field The name of the property
037 * @param value The value of the property
038 */
039 void set(String field, NoSqlObject<W> value);
040
041 /**
042 * Sets the value of a property on this object to an array of Strings or primitives.
043 *
044 * @param field The name of the property
045 * @param values The values for the property
046 */
047 void set(String field, Object[] values);
048
049 /**
050 * Sets the value of a property on this object to an array of nested complex objects.
051 *
052 * @param field The name of the property
053 * @param values The values for the property
054 */
055 void set(String field, NoSqlObject<W>[] values);
056
057 /**
058 * Obtains the underlying NoSQL library-specific object that this object wraps.
059 *
060 * @return the wrapped object.
061 */
062 W unwrap();
063 }