org.apache.juneau.parser.ParserSessionArgs Maven / Gradle / Ivy
// ***************************************************************************************************************************
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance *
// * with the License. You may obtain a copy of the License at *
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 *
// * *
// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an *
// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the *
// * specific language governing permissions and limitations under the License. *
// ***************************************************************************************************************************
package org.apache.juneau.parser;
import java.lang.reflect.*;
import java.util.*;
import org.apache.juneau.*;
import org.apache.juneau.http.*;
import org.apache.juneau.httppart.*;
/**
* Runtime arguments common to all parser sessions.
*/
public final class ParserSessionArgs extends BeanSessionArgs {
Method javaMethod;
Object outer;
/**
* Default parser session args.
*/
public static final ParserSessionArgs DEFAULT = new ParserSessionArgs();
/**
* Constructor
*/
public ParserSessionArgs() {}
/**
* Constructor.
*
* @param properties
* Session-level properties.
*
These override context-level properties.
*
Can be null .
* @param javaMethod
* The java method that called this serializer, usually the method in a REST servlet.
*
Can be null .
* @param locale
* The session locale.
*
If null , then the locale defined on the context is used.
* @param timeZone
* The session timezone.
*
If null , then the timezone defined on the context is used.
* @param mediaType
* The session media type (e.g. "application/json" ).
*
Can be null .
* @param schema
* The part schema for the serialized part.
*
Can be null .
* @param debug
* Enable debug mode for this session.
*
Can be null to use the debug setting on the bean context..
* @param outer
* The outer object for instantiating top-level non-static inner classes.
*/
public ParserSessionArgs(ObjectMap properties, Method javaMethod, Locale locale, TimeZone timeZone, MediaType mediaType, HttpPartSchema schema, Boolean debug, Object outer) {
super(properties, locale, timeZone, mediaType, schema, debug);
this.javaMethod = javaMethod;
this.outer = outer;
}
/**
* The java method that called this serializer, usually the method in a REST servlet.
*
* @param javaMethod
* The java method that called this serializer, usually the method in a REST servlet.
*
Can be null .
* @return This object (for method chaining).
*/
public ParserSessionArgs javaMethod(Method javaMethod) {
this.javaMethod = javaMethod;
return this;
}
/**
* The outer object for instantiating top-level non-static inner classes.
*
* @param outer
* The outer object for instantiating top-level non-static inner classes.
* @return This object (for method chaining).
*/
public ParserSessionArgs outer(Object outer) {
this.outer = outer;
return this;
}
@Override /* BeanSessionArgs */
public ParserSessionArgs locale(Locale locale) {
super.locale(locale);
return this;
}
@Override /* BeanSessionArgs */
public ParserSessionArgs timeZone(TimeZone timeZone) {
super.timeZone(timeZone);
return this;
}
@Override /* BeanSessionArgs */
public ParserSessionArgs mediaType(MediaType mediaType) {
super.mediaType(mediaType);
return this;
}
@Override /* SessionArgs */
public ParserSessionArgs properties(ObjectMap properties) {
super.properties(properties);
return this;
}
}