001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.parser; 014 015import java.lang.reflect.*; 016import java.util.*; 017 018import org.apache.juneau.*; 019import org.apache.juneau.http.*; 020 021/** 022 * Runtime arguments common to all parser sessions. 023 */ 024public final class ParserSessionArgs extends BeanSessionArgs { 025 026 Method javaMethod; 027 Object outer; 028 029 /** 030 * Constructor 031 */ 032 public ParserSessionArgs() {} 033 034 /** 035 * Constructor. 036 * 037 * @param properties 038 * Session-level properties. 039 * <br>These override context-level properties. 040 * <br>Can be <jk>null</jk>. 041 * @param javaMethod 042 * The java method that called this serializer, usually the method in a REST servlet. 043 * <br>Can be <jk>null</jk>. 044 * @param locale 045 * The session locale. 046 * <br>If <jk>null</jk>, then the locale defined on the context is used. 047 * @param timeZone 048 * The session timezone. 049 * <br>If <jk>null</jk>, then the timezone defined on the context is used. 050 * @param mediaType 051 * The session media type (e.g. <js>"application/json"</js>). 052 * <br>Can be <jk>null</jk>. 053 * @param outer 054 * The outer object for instantiating top-level non-static inner classes. 055 */ 056 public ParserSessionArgs(ObjectMap properties, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType, Object outer) { 057 super(properties, locale, timeZone, mediaType); 058 this.javaMethod = javaMethod; 059 this.outer = outer; 060 } 061 062 063 /** 064 * The java method that called this serializer, usually the method in a REST servlet. 065 * 066 * @param javaMethod 067 * The java method that called this serializer, usually the method in a REST servlet. 068 * <br>Can be <jk>null</jk>. 069 * @return This object (for method chaining). 070 */ 071 public ParserSessionArgs javaMethod(Method javaMethod) { 072 this.javaMethod = javaMethod; 073 return this; 074 } 075 076 /** 077 * The outer object for instantiating top-level non-static inner classes. 078 * 079 * @param outer 080 * The outer object for instantiating top-level non-static inner classes. 081 * @return This object (for method chaining). 082 */ 083 public ParserSessionArgs outer(Object outer) { 084 this.outer = outer; 085 return this; 086 } 087 088 @Override /* BeanSessionArgs */ 089 public ParserSessionArgs locale(Locale locale) { 090 super.locale(locale); 091 return this; 092 } 093 094 @Override /* BeanSessionArgs */ 095 public ParserSessionArgs timeZone(TimeZone timeZone) { 096 super.timeZone(timeZone); 097 return this; 098 } 099 100 @Override /* BeanSessionArgs */ 101 public ParserSessionArgs mediaType(MediaType mediaType) { 102 super.mediaType(mediaType); 103 return this; 104 } 105 106 @Override /* SessionArgs */ 107 public ParserSessionArgs properties(ObjectMap properties) { 108 super.properties(properties); 109 return this; 110 } 111}