[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/APIJSON/APIJSON/main/src/main/java/apijson/orm/ObjectParser.java [Back]  [Original]

/*Copyright (C) 2026 the APIJSON group.  All rights reserved.

This source code is licensed under the Apache License Version 2.0.*/


package apijson.orm;

import java.util.List;
import java.util.Map;

import apijson.*;

/**ParsergetObjectgetArray(getArrayConfig)
 * @author Lemon
 */
public interface ObjectParser {

	Parser getParser();
	ObjectParser setParser(Parser parser);

	String getParentPath();
	ObjectParser setParentPath(String parentPath);

	ObjectParser setCache(M cache);
	M getCache();


	/**
	 * response
	 * @param name
	 * @param isReuse 
	 * @return null or this
	 * @throws Exception
	 */
	ObjectParser parse(String name, boolean isReuse) throws Exception;

	/** parser  sqlExecutor 
	 * @param method
	 * @param table
	 * @param alias
	 * @param request
	 * @param joinList
	 * @param isProcedure
	 * @return
	 * @throws Exception
	 */
	M parseResponse(RequestMethod method, String table, String alias, M request, List joinList, boolean isProcedure) throws Exception;
	/** parser  sqlExecutor 
	 * @param config
	 * @param isProcedure
	 * @return
	 * @throws Exception
	 */
	M parseResponse(SQLConfig config, boolean isProcedure) throws Exception;


	/**
	 * @param key
	 * @param value
	 * @return whether parse succeed
	 */
	boolean onParse(@NotNull String key, @NotNull Object value) throws Exception;

	/**
	 * @param index
	 * @param key
	 * @param value
	 * @param cache SQL 
	 * @return
	 * @throws Exception
	 */
	Object onChildParse(int index, String key, M value, Object cache) throws Exception;
	
	/**
	 * @param path
	 * @return
	 */
	Object onReferenceParse(@NotNull String path);

	//TODO  MySQL json_add,json_remove,json_contains  
	/** PUT key:[]
	 * @param key
	 * @param array
	 * @throws Exception
	 */
	void onPUTArrayParse(@NotNull String key, @NotNull L array) throws Exception;

	/** POST or PUT  Table[]:[{}]
	 * @param key
	 * @param array
	 * @throws Exception
	 */
	void onTableArrayParse(@NotNull String key, @NotNull L array) throws Exception;

	/**SQL for single object
	 * @return {@link #setSQLConfig(int, int, int)}
	 * @throws Exception
	 */
	ObjectParser setSQLConfig() throws Exception;

	/**SQL 
	 * @return 
	 * @throws Exception
	 */
	ObjectParser setSQLConfig(int count, int page, int position) throws Exception;
	
	
	/** SQL
	 * @return 
	 * @throws Exception
	 */
	ObjectParser executeSQL() throws Exception;

	
	/**
	 * @return
	 * @throws Exception
	 */
	M onSQLExecute() throws Exception;
	
	
	/**
	 * @return response
	 * @throws Exception
	 */
	M response() throws Exception;

	void onFunctionResponse(String type) throws Exception;

	void onChildResponse() throws Exception;
	

	SQLConfig newSQLConfig(boolean isProcedure) throws Exception;
	SQLConfig newSQLConfig(RequestMethod method, String table, String alias, M request, List joinList, boolean isProcedure) throws Exception;
	
	/**
	 * response has the final value after parse (and query if isTableKey)
	 */
	void onComplete();


	/**
	 */
	void recycle();


	ObjectParser setMethod(RequestMethod method);
	RequestMethod getMethod();


	boolean isTable();
	String getPath();
	String getTable();
	String getAlias();
	SQLConfig getArrayConfig();

	SQLConfig getSQLConfig();
	M getResponse();
	M getSQLRequest();
	M getSQLResponse();

	Map getCustomMap();
	Map getFunctionMap();
	Map getChildMap();

}

Web Proxy Viewer  |  New URL  |  Original Page