Fix order of modifiers

Original commit: elastic/x-pack-elasticsearch@1f970e78ba
This commit is contained in:
Tanguy Leroux 2016-07-01 16:29:00 +02:00
parent 158a6b5588
commit 17684f1e76
72 changed files with 174 additions and 174 deletions

View File

@ -13,11 +13,11 @@ import org.joda.time.format.ISODateTimeFormat;
public class DateUtils {
private final static FormatDateTimeFormatter formatDateOnlyFormatter = Joda.forPattern("yyyy-MM-dd");
private static final FormatDateTimeFormatter formatDateOnlyFormatter = Joda.forPattern("yyyy-MM-dd");
private final static DateTimeFormatter dateOnlyFormatter = formatDateOnlyFormatter.parser().withZoneUTC();
private static final DateTimeFormatter dateOnlyFormatter = formatDateOnlyFormatter.parser().withZoneUTC();
private final static DateTimeFormatter dateTimeFormatter = ISODateTimeFormat.dateTime().withZoneUTC();
private static final DateTimeFormatter dateTimeFormatter = ISODateTimeFormat.dateTime().withZoneUTC();
public static long endOfTheDay(String date) {
try {

View File

@ -29,9 +29,9 @@ import java.util.Locale;
* Provides serialization/deserialization & validation methods for license object
*/
public class License implements ToXContent {
public final static int VERSION_START = 1;
public final static int VERSION_NO_FEATURE_TYPE = 2;
public final static int VERSION_CURRENT = VERSION_NO_FEATURE_TYPE;
public static final int VERSION_START = 1;
public static final int VERSION_NO_FEATURE_TYPE = 2;
public static final int VERSION_CURRENT = VERSION_NO_FEATURE_TYPE;
/**
* XContent param name to deserialize license(s) with
@ -51,7 +51,7 @@ public class License implements ToXContent {
*/
public static final String LICENSE_VERSION_MODE = "license_version";
public final static Comparator<License> LATEST_ISSUE_DATE_FIRST = new Comparator<License>() {
public static final Comparator<License> LATEST_ISSUE_DATE_FIRST = new Comparator<License>() {
@Override
public int compare(License right, License left) {
return Long.compare(left.issueDate(), right.issueDate());
@ -506,7 +506,7 @@ public class License implements ToXContent {
return result;
}
public final static class Fields {
public static final class Fields {
public static final String STATUS = "status";
public static final String UID = "uid";
public static final String TYPE = "type";

View File

@ -25,9 +25,9 @@ import static org.hamcrest.core.IsEqual.equalTo;
public class TestUtils {
private final static FormatDateTimeFormatter formatDateTimeFormatter = Joda.forPattern("yyyy-MM-dd");
private final static DateMathParser dateMathParser = new DateMathParser(formatDateTimeFormatter);
private final static DateTimeFormatter dateTimeFormatter = formatDateTimeFormatter.printer();
private static final FormatDateTimeFormatter formatDateTimeFormatter = Joda.forPattern("yyyy-MM-dd");
private static final DateMathParser dateMathParser = new DateMathParser(formatDateTimeFormatter);
private static final DateTimeFormatter dateTimeFormatter = formatDateTimeFormatter.printer();
public static String dateMathString(String time, final long now) {
return dateTimeFormatter.print(dateMathParser.parse(time, new Callable<Long>() {

View File

@ -33,7 +33,7 @@ import java.util.Collections;
*/
public class LicenseSigner {
private final static int MAGIC_LENGTH = 13;
private static final int MAGIC_LENGTH = 13;
private final Path publicKeyPath;

View File

@ -36,9 +36,9 @@ public class TestUtils {
public static final String PUBLIC_KEY_RESOURCE = "/public.key";
public static final String PRIVATE_KEY_RESOURCE = "/private.key";
private final static FormatDateTimeFormatter formatDateTimeFormatter = Joda.forPattern("yyyy-MM-dd");
private final static DateMathParser dateMathParser = new DateMathParser(formatDateTimeFormatter);
private final static DateTimeFormatter dateTimeFormatter = formatDateTimeFormatter.printer();
private static final FormatDateTimeFormatter formatDateTimeFormatter = Joda.forPattern("yyyy-MM-dd");
private static final DateMathParser dateMathParser = new DateMathParser(formatDateTimeFormatter);
private static final DateTimeFormatter dateTimeFormatter = formatDateTimeFormatter.printer();
public static String dumpLicense(License license) throws Exception {
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);

View File

@ -93,7 +93,7 @@ public class SearchInputIT extends ESIntegTestCase {
return types;
}
private final static String TEMPLATE_QUERY = "{\"query\":{\"bool\":{\"must\":{\"match\":{\"event_type\":{\"query\":\"a\"," +
private static final String TEMPLATE_QUERY = "{\"query\":{\"bool\":{\"must\":{\"match\":{\"event_type\":{\"query\":\"a\"," +
"\"type\":\"boolean\"}}},\"filter\":{\"range\":{\"_timestamp\":" +
"{\"from\":\"{{ctx.trigger.scheduled_time}}||-{{seconds_param}}\",\"to\":\"{{ctx.trigger.scheduled_time}}\"," +
"\"include_lower\":true,\"include_upper\":true}}}}}}";

View File

@ -22,8 +22,8 @@ import static org.elasticsearch.xpack.security.authc.support.UsernamePasswordTok
public class GraphWithSecurityIT extends ESRestTestCase {
private final static String TEST_ADMIN_USERNAME = "test_admin";
private final static String TEST_ADMIN_PASSWORD = "changeme";
private static final String TEST_ADMIN_USERNAME = "test_admin";
private static final String TEST_ADMIN_PASSWORD = "changeme";
public GraphWithSecurityIT(@Name("yaml") RestTestCandidate testCandidate) {
super(testCandidate);

View File

@ -27,8 +27,8 @@ import static org.elasticsearch.xpack.security.authc.support.UsernamePasswordTok
public class WatcherWithSecurityIT extends ESRestTestCase {
private final static String TEST_ADMIN_USERNAME = "test_admin";
private final static String TEST_ADMIN_PASSWORD = "changeme";
private static final String TEST_ADMIN_USERNAME = "test_admin";
private static final String TEST_ADMIN_PASSWORD = "changeme";
public WatcherWithSecurityIT(@Name("yaml") RestTestCandidate testCandidate) {
super(testCandidate);

View File

@ -10,7 +10,7 @@ import org.elasticsearch.rest.RestStatus;
public class LicenseUtils {
public final static String EXPIRED_FEATURE_HEADER = "es.license.expired.feature";
public static final String EXPIRED_FEATURE_HEADER = "es.license.expired.feature";
/**
* Exception to be thrown when a feature action requires a valid license, but license

View File

@ -239,7 +239,7 @@ public class LicensesMetaData extends AbstractDiffable<MetaData.Custom> implemen
return new LicensesMetaData(license);
}
private final static class Fields {
private static final class Fields {
private static final String SIGNED_LICENCES = "signed_licenses";
private static final String TRIAL_LICENSES = "trial_licenses";
private static final String LICENSE = "license";

View File

@ -643,11 +643,11 @@ public class LicensesService extends AbstractLifecycleComponent<LicensesService>
}
}
public static abstract class ExpirationCallback {
public abstract static class ExpirationCallback {
public enum Orientation {PRE, POST}
public static abstract class Pre extends ExpirationCallback {
public abstract static class Pre extends ExpirationCallback {
/**
* Callback schedule prior to license expiry
@ -677,7 +677,7 @@ public class LicensesService extends AbstractLifecycleComponent<LicensesService>
}
}
public static abstract class Post extends ExpirationCallback {
public abstract static class Post extends ExpirationCallback {
/**
* Callback schedule after license expiry

View File

@ -48,8 +48,8 @@ import static org.junit.Assert.assertThat;
public class TestUtils {
private final static FormatDateTimeFormatter formatDateTimeFormatter = Joda.forPattern("yyyy-MM-dd");
private final static DateMathParser dateMathParser = new DateMathParser(formatDateTimeFormatter);
private static final FormatDateTimeFormatter formatDateTimeFormatter = Joda.forPattern("yyyy-MM-dd");
private static final DateMathParser dateMathParser = new DateMathParser(formatDateTimeFormatter);
public static long dateMath(String time, final long now) {
return dateMathParser.parse(time, new Callable<Long>() {

View File

@ -16,7 +16,7 @@ import org.elasticsearch.common.settings.Settings;
*/
public class EagerLicenseRegistrationConsumerPlugin extends TestConsumerPluginBase {
public final static String NAME = "test_consumer_plugin_1";
public static final String NAME = "test_consumer_plugin_1";
@Inject
public EagerLicenseRegistrationConsumerPlugin(Settings settings) {

View File

@ -82,7 +82,7 @@ public class MonitoringFeatureSet implements XPackFeatureSet {
private static final String ENABLED_EXPORTERS_XFIELD = "enabled_exporters";
private @Nullable Map<String, Object> exporters;
@Nullable private Map<String, Object> exporters;
public Usage(StreamInput in) throws IOException {
super(in);

View File

@ -23,7 +23,8 @@ public abstract class Exporter implements AutoCloseable {
protected final Config config;
protected final ESLogger logger;
protected final @Nullable TimeValue bulkTimeout;
@Nullable protected final TimeValue bulkTimeout;
private AtomicBoolean closed = new AtomicBoolean(false);
public Exporter(String type, Config config) {
@ -103,7 +104,7 @@ public abstract class Exporter implements AutoCloseable {
}
}
public static abstract class Factory<E extends Exporter> {
public abstract static class Factory<E extends Exporter> {
private final String type;
private final boolean singleton;

View File

@ -535,7 +535,7 @@ public class HttpExporter extends Exporter {
}
}
static private void validateHosts(String[] hosts) {
private static void validateHosts(String[] hosts) {
for (String host : hosts) {
try {
HttpExporterUtils.parseHostWithPath(host, "");

View File

@ -126,7 +126,7 @@ public abstract class MonitoringIndexNameResolver<T extends MonitoringDoc> {
* Data index name resolvers are used used to index documents in
* the monitoring data index (.monitoring-data-{VERSION})
*/
public static abstract class Data<T extends MonitoringDoc> extends MonitoringIndexNameResolver<T> {
public abstract static class Data<T extends MonitoringDoc> extends MonitoringIndexNameResolver<T> {
public static final String DATA = "data";
@ -166,7 +166,7 @@ public abstract class MonitoringIndexNameResolver<T extends MonitoringDoc> {
* Timestamped index name resolvers are used used to index documents in
* a timestamped index (.monitoring-{ID}-{VERSION}-YYYY.MM.dd)
*/
public static abstract class Timestamped<T extends MonitoringDoc> extends MonitoringIndexNameResolver<T> {
public abstract static class Timestamped<T extends MonitoringDoc> extends MonitoringIndexNameResolver<T> {
public static final Setting<String> INDEX_NAME_TIME_FORMAT_SETTING = new Setting<>("index.name.time_format", "YYYY.MM.dd",
Function.identity(), Setting.Property.NodeScope);

View File

@ -32,7 +32,7 @@ public class SecurityFeatureSet implements XPackFeatureSet {
private final boolean enabled;
private final SecurityLicenseState licenseState;
private final @Nullable Realms realms;
@Nullable private final Realms realms;
@Inject
public SecurityFeatureSet(Settings settings, @Nullable SecurityLicenseState licenseState,

View File

@ -111,7 +111,7 @@ public abstract class Realm<T extends AuthenticationToken> implements Comparable
* settings. The factory will be called when creating a realm during the parsing of realms defined in the
* elasticsearch.yml file
*/
public static abstract class Factory<R extends Realm> {
public abstract static class Factory<R extends Realm> {
private final String type;
private final boolean internal;

View File

@ -88,7 +88,7 @@ public class ActiveDirectoryGroupsResolver implements GroupsResolver {
*
* @param SID byte encoded security ID
*/
static public String binarySidToStringSid(byte[] SID) {
public static String binarySidToStringSid(byte[] SID) {
String strSID;
//convert the SID into string format

View File

@ -101,7 +101,7 @@ public abstract class AbstractLdapRealm extends CachingUsernamePasswordRealm {
}
}
public static abstract class Factory<R extends AbstractLdapRealm> extends UsernamePasswordRealm.Factory<R> {
public abstract static class Factory<R extends AbstractLdapRealm> extends UsernamePasswordRealm.Factory<R> {
public Factory(String type, RestController restController) {
super(type, restController, false);

View File

@ -337,13 +337,13 @@ public class BCrypt {
// bcrypt IV: "OrpheanBeholderScryDoubt". The C implementation calls
// this "ciphertext", but it is really plaintext or an IV. We keep
// the name to make code comparison easier.
static private final int bf_crypt_ciphertext[] = {
private static final int bf_crypt_ciphertext[] = {
0x4f727068, 0x65616e42, 0x65686f6c,
0x64657253, 0x63727944, 0x6f756274
};
// Table for Base64 encoding
static private final char base64_code[] = {
private static final char base64_code[] = {
'.', '/', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
@ -353,7 +353,7 @@ public class BCrypt {
};
// Table for Base64 decoding
static private final byte index_64[] = {
private static final byte index_64[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,

View File

@ -31,7 +31,7 @@ public abstract class UsernamePasswordRealm extends Realm<UsernamePasswordToken>
return token instanceof UsernamePasswordToken;
}
public static abstract class Factory<R extends UsernamePasswordRealm> extends Realm.Factory<R> {
public abstract static class Factory<R extends UsernamePasswordRealm> extends Realm.Factory<R> {
protected Factory(String type, RestController restController, boolean internal) {
super(type, internal);

View File

@ -31,7 +31,7 @@ public final class DocumentSubsetReader extends FilterLeafReader {
return new DocumentSubsetDirectoryReader(in, bitsetFilterCache, roleQuery);
}
final static class DocumentSubsetDirectoryReader extends FilterDirectoryReader {
static final class DocumentSubsetDirectoryReader extends FilterDirectoryReader {
private final Query roleQuery;
private final BitsetFilterCache bitsetFilterCache;

View File

@ -40,7 +40,7 @@ public class ClusterPrivilege extends AbstractAutomatonPrivilege<ClusterPrivileg
public static final ClusterPrivilege TRANSPORT_CLIENT = new ClusterPrivilege("transport_client", TRANSPORT_CLIENT_AUTOMATON);
public static final ClusterPrivilege MANAGE_SECURITY = new ClusterPrivilege("manage_security", MANAGE_SECURITY_AUTOMATON);
public final static Predicate<String> ACTION_MATCHER = ClusterPrivilege.ALL.predicate();
public static final Predicate<String> ACTION_MATCHER = ClusterPrivilege.ALL.predicate();
private static final Set<ClusterPrivilege> values = new CopyOnWriteArraySet<>();

View File

@ -33,7 +33,7 @@ public abstract class AbstractSecurityModule extends AbstractModule {
protected abstract void configure(boolean clientMode);
public static abstract class Node extends AbstractSecurityModule {
public abstract static class Node extends AbstractSecurityModule {
protected Node(Settings settings) {
super(settings);

View File

@ -211,7 +211,7 @@ public class SecurityServerTransportService extends TransportService {
* This handler wrapper ensures that the response thread executes with the correct thread context. Before any of the4 handle methods
* are invoked we restore the context.
*/
private final static class ContextRestoreResponseHandler<T extends TransportResponse> implements TransportResponseHandler<T> {
private static final class ContextRestoreResponseHandler<T extends TransportResponse> implements TransportResponseHandler<T> {
private final TransportResponseHandler<T> delegate;
private final ThreadContext.StoredContext threadContext;

View File

@ -79,7 +79,7 @@ public class SecurityNettyTransport extends NettyTransport {
private final ServerSSLService serverSslService;
private final ClientSSLService clientSSLService;
private final @Nullable IPFilter authenticator;
@Nullable private final IPFilter authenticator;
private final boolean ssl;
@Inject

View File

@ -35,8 +35,8 @@ public class User implements ToXContent {
private final User runAs;
private final Map<String, Object> metadata;
private final @Nullable String fullName;
private final @Nullable String email;
@Nullable private final String fullName;
@Nullable private final String email;
public User(String username, String... roles) {
this(username, roles, null, null, null);

View File

@ -37,7 +37,7 @@ import static org.hamcrest.Matchers.is;
* This test assumes all subclass tests will be of type SUITE. It picks a random realm configuration for the tests, and
* writes a group to role mapping file for each node.
*/
abstract public class AbstractAdLdapRealmTestCase extends SecurityIntegTestCase {
public abstract class AbstractAdLdapRealmTestCase extends SecurityIntegTestCase {
public static final String XPACK_SECURITY_AUTHC_REALMS_EXTERNAL = "xpack.security.authc.realms.external";
public static final String PASSWORD = "NickFuryHeartsES";

View File

@ -29,9 +29,9 @@ import java.util.stream.Collectors;
*/
public class XPackInfoResponse extends ActionResponse {
private @Nullable BuildInfo buildInfo;
private @Nullable LicenseInfo licenseInfo;
private @Nullable FeatureSetsInfo featureSetsInfo;
@Nullable private BuildInfo buildInfo;
@Nullable private LicenseInfo licenseInfo;
@Nullable private FeatureSetsInfo featureSetsInfo;
public XPackInfoResponse() {}
@ -221,7 +221,7 @@ public class XPackInfoResponse extends ActionResponse {
public static class FeatureSet implements ToXContent, Writeable {
private final String name;
private final @Nullable String description;
@Nullable private final String description;
private final boolean available;
private final boolean enabled;

View File

@ -41,14 +41,14 @@ public class HttpRequest implements ToXContent {
final int port;
final Scheme scheme;
final HttpMethod method;
final @Nullable String path;
@Nullable final String path;
final Map<String, String> params;
final Map<String, String> headers;
final @Nullable HttpAuth auth;
final @Nullable String body;
final @Nullable TimeValue connectionTimeout;
final @Nullable TimeValue readTimeout;
final @Nullable HttpProxy proxy;
@Nullable final HttpAuth auth;
@Nullable final String body;
@Nullable final TimeValue connectionTimeout;
@Nullable final TimeValue readTimeout;
@Nullable final HttpProxy proxy;
public HttpRequest(String host, int port, @Nullable Scheme scheme, @Nullable HttpMethod method, @Nullable String path,
@Nullable Map<String, String> params, @Nullable Map<String, String> headers,

View File

@ -46,9 +46,9 @@ public class HttpRequestTemplate implements ToXContent {
private final Map<String, TextTemplate> headers;
private final HttpAuth auth;
private final TextTemplate body;
private final @Nullable TimeValue connectionTimeout;
private final @Nullable TimeValue readTimeout;
private final @Nullable HttpProxy proxy;
@Nullable private final TimeValue connectionTimeout;
@Nullable private final TimeValue readTimeout;
@Nullable private final HttpProxy proxy;
public HttpRequestTemplate(String host, int port, @Nullable Scheme scheme, @Nullable HttpMethod method, @Nullable TextTemplate path,
Map<String, TextTemplate> params, Map<String, TextTemplate> headers, HttpAuth auth,

View File

@ -27,9 +27,9 @@ import java.util.Map;
public class TextTemplate implements ToXContent {
private final String template;
private final @Nullable XContentType contentType;
private final @Nullable ScriptType type;
private final @Nullable Map<String, Object> params;
@Nullable private final XContentType contentType;
@Nullable private final ScriptType type;
@Nullable private final Map<String, Object> params;
public TextTemplate(String template) {
this(template, null, null, null);
@ -190,7 +190,7 @@ public class TextTemplate implements ToXContent {
return new Builder.DefaultType(text);
}
public static abstract class Builder<B extends Builder> {
public abstract static class Builder<B extends Builder> {
protected final ScriptType type;
protected final String template;

View File

@ -29,12 +29,12 @@ import java.util.Map;
public class HipChatMessage implements ToXContent {
final String body;
final @Nullable String[] rooms;
final @Nullable String[] users;
final @Nullable String from;
final @Nullable Format format;
final @Nullable Color color;
final @Nullable Boolean notify;
@Nullable final String[] rooms;
@Nullable final String[] users;
@Nullable final String from;
@Nullable final Format format;
@Nullable final Color color;
@Nullable final Boolean notify;
public HipChatMessage(String body, String[] rooms, String[] users, String from, Format format, Color color, Boolean notify) {
this.body = body;
@ -141,13 +141,13 @@ public class HipChatMessage implements ToXContent {
public static class Template implements ToXContent {
final TextTemplate body;
final @Nullable TextTemplate[] rooms;
final @Nullable TextTemplate[] users;
final @Nullable String from;
final @Nullable Format format;
final @Nullable
@Nullable final TextTemplate[] rooms;
@Nullable final TextTemplate[] users;
@Nullable final String from;
@Nullable final Format format;
@Nullable final
TextTemplate color;
final @Nullable Boolean notify;
@Nullable final Boolean notify;
public Template(TextTemplate body,
TextTemplate[] rooms,

View File

@ -129,9 +129,9 @@ public class IntegrationAccount extends HipChatAccount {
static class Defaults {
final @Nullable Format format;
final @Nullable Color color;
final @Nullable Boolean notify;
@Nullable final Format format;
@Nullable final Color color;
@Nullable final Boolean notify;
public Defaults(Settings settings) {
this.format = Format.resolve(settings, DEFAULT_FORMAT_SETTING, null);

View File

@ -70,9 +70,9 @@ public class SentMessages implements ToXContent, Iterable<SentMessages.SentMessa
final String targetName;
final TargetType targetType;
final HipChatMessage message;
final @Nullable HttpRequest request;
final @Nullable HttpResponse response;
final @Nullable String failureReason;
@Nullable final HttpRequest request;
@Nullable final HttpResponse response;
@Nullable final String failureReason;
public static SentMessage responded(String targetName, TargetType targetType, HipChatMessage message, HttpRequest request,
HttpResponse response) {

View File

@ -165,11 +165,11 @@ public class UserAccount extends HipChatAccount {
static class Defaults {
final @Nullable String[] rooms;
final @Nullable String[] users;
final @Nullable Format format;
final @Nullable Color color;
final @Nullable Boolean notify;
@Nullable final String[] rooms;
@Nullable final String[] users;
@Nullable final Format format;
@Nullable final Color color;
@Nullable final Boolean notify;
public Defaults(Settings settings) {
this.rooms = settings.getAsArray(DEFAULT_ROOM_SETTING, null);

View File

@ -122,11 +122,11 @@ public class V1Account extends HipChatAccount {
static class Defaults {
final @Nullable String[] rooms;
final @Nullable String from;
final @Nullable Format format;
final @Nullable Color color;
final @Nullable Boolean notify;
@Nullable final String[] rooms;
@Nullable final String from;
@Nullable final Format format;
@Nullable final Color color;
@Nullable final Boolean notify;
public Defaults(Settings settings) {
this.rooms = settings.getAsArray(DEFAULT_ROOM_SETTING, null);

View File

@ -41,13 +41,13 @@ public class IncidentEvent implements ToXContent {
static final String PATH = "/generic/2010-04-15/create_event.json";
final String description;
final @Nullable String incidentKey;
final @Nullable String client;
final @Nullable String clientUrl;
final @Nullable String account;
@Nullable final String incidentKey;
@Nullable final String client;
@Nullable final String clientUrl;
@Nullable final String account;
final String eventType;
final boolean attachPayload;
final @Nullable IncidentEventContext[] contexts;
@Nullable final IncidentEventContext[] contexts;
public IncidentEvent(String description, @Nullable String eventType, @Nullable String incidentKey, @Nullable String client,
@Nullable String clientUrl, @Nullable String account, boolean attachPayload,

View File

@ -28,9 +28,9 @@ import java.util.Objects;
public class SentEvent implements ToXContent {
final IncidentEvent event;
final @Nullable HttpRequest request;
final @Nullable HttpResponse response;
final @Nullable String failureReason;
@Nullable final HttpRequest request;
@Nullable final HttpResponse response;
@Nullable final String failureReason;
public static SentEvent responded(IncidentEvent event, HttpRequest request, HttpResponse response) {
String failureReason = resolveFailureReason(response);

View File

@ -63,9 +63,9 @@ public class SentMessages implements ToXContent, Iterable<SentMessages.SentMessa
final String to;
final SlackMessage message;
final @Nullable HttpRequest request;
final @Nullable HttpResponse response;
final @Nullable String failureReason;
@Nullable final HttpRequest request;
@Nullable final HttpResponse response;
@Nullable final String failureReason;
public static SentMessage responded(String to, SlackMessage message, HttpRequest request, HttpResponse response) {
String failureReason = resolveFailureReason(response);

View File

@ -19,8 +19,8 @@ import java.util.EnumSet;
public class WatcherMetaData extends AbstractDiffable<MetaData.Custom> implements MetaData.Custom {
public final static String TYPE = "watcher";
public final static WatcherMetaData PROTO = new WatcherMetaData(false);
public static final String TYPE = "watcher";
public static final WatcherMetaData PROTO = new WatcherMetaData(false);
private final boolean manuallyStopped;

View File

@ -30,9 +30,9 @@ import static org.elasticsearch.xpack.watcher.support.WatcherDateTimeUtils.dateT
public class ActionStatus implements ToXContent {
private AckStatus ackStatus;
private @Nullable Execution lastExecution;
private @Nullable Execution lastSuccessfulExecution;
private @Nullable Throttle lastThrottle;
@Nullable private Execution lastExecution;
@Nullable private Execution lastSuccessfulExecution;
@Nullable private Throttle lastThrottle;
public ActionStatus(DateTime now) {
this(new AckStatus(now, AckStatus.State.AWAITS_SUCCESSFUL_EXECUTION), null, null, null);

View File

@ -33,7 +33,7 @@ import java.io.IOException;
public class ActionWrapper implements ToXContent {
private String id;
private final @Nullable ExecutableTransform transform;
@Nullable private final ExecutableTransform transform;
private final ActionThrottler throttler;
private final ExecutableAction action;
@ -185,7 +185,7 @@ public class ActionWrapper implements ToXContent {
public static class Result implements ToXContent {
private final String id;
private final @Nullable Transform.Result transform;
@Nullable private final Transform.Result transform;
private final Action.Result action;
public Result(String id, Action.Result action) {

View File

@ -35,11 +35,11 @@ public class EmailAction implements Action {
public static final String TYPE = "email";
private final EmailTemplate email;
private final @Nullable String account;
private final @Nullable Authentication auth;
private final @Nullable Profile profile;
private final @Nullable DataAttachment dataAttachment;
private final @Nullable EmailAttachments emailAttachments;
@Nullable private final String account;
@Nullable private final Authentication auth;
@Nullable private final Profile profile;
@Nullable private final DataAttachment dataAttachment;
@Nullable private final EmailAttachments emailAttachments;
public EmailAction(EmailTemplate email, @Nullable String account, @Nullable Authentication auth, @Nullable Profile profile,
@Nullable DataAttachment dataAttachment, @Nullable EmailAttachments emailAttachments) {
@ -186,7 +186,7 @@ public class EmailAction implements Action {
return new Builder(email);
}
public static abstract class Result extends Action.Result {
public abstract static class Result extends Action.Result {
protected Result(Status status) {
super(TYPE, status);

View File

@ -26,7 +26,7 @@ public class HipChatAction implements Action {
public static final String TYPE = "hipchat";
final @Nullable String account;
@Nullable final String account;
final HipChatMessage.Template message;
public HipChatAction(@Nullable String account, HipChatMessage.Template message) {

View File

@ -28,9 +28,9 @@ public class IndexAction implements Action {
final String index;
final String docType;
final @Nullable String executionTimeField;
final @Nullable TimeValue timeout;
final @Nullable DateTimeZone dynamicNameTimeZone;
@Nullable final String executionTimeField;
@Nullable final TimeValue timeout;
@Nullable final DateTimeZone dynamicNameTimeZone;
public IndexAction(String index, String docType, @Nullable String executionTimeField,
@Nullable TimeValue timeout, @Nullable DateTimeZone dynamicNameTimeZone) {

View File

@ -25,8 +25,8 @@ public class LoggingAction implements Action {
public static final String TYPE = "logging";
final TextTemplate text;
final @Nullable LoggingLevel level;
final @Nullable String category;
@Nullable final LoggingLevel level;
@Nullable final String category;
public LoggingAction(TextTemplate text, @Nullable LoggingLevel level, @Nullable String category) {
this.text = text;

View File

@ -25,9 +25,8 @@ public class SlackAction implements Action {
public static final String TYPE = "slack";
final
@Nullable
String account;
@Nullable final String account;
final SlackMessage.Template message;
public SlackAction(@Nullable String account, SlackMessage.Template message) {

View File

@ -18,7 +18,7 @@ import org.joda.time.PeriodType;
*/
public class PeriodThrottler implements Throttler {
private final @Nullable TimeValue period;
@Nullable private final TimeValue period;
private final PeriodType periodType;
private final Clock clock;

View File

@ -172,8 +172,8 @@ public class WatchSourceBuilder implements ToXContent {
private final String id;
private final Action action;
private final @Nullable TimeValue throttlePeriod;
private final @Nullable Transform transform;
@Nullable private final TimeValue throttlePeriod;
@Nullable private final Transform transform;
public TransformedAction(String id, Action action, @Nullable TimeValue throttlePeriod, @Nullable Transform transform) {
this.id = id;

View File

@ -131,7 +131,7 @@ public class CompareCondition implements Condition {
public static class Result extends Condition.Result {
private final @Nullable Map<String, Object> resolveValues;
@Nullable private final Map<String, Object> resolveValues;
Result(Map<String, Object> resolveValues, boolean met) {
super(TYPE, met);

View File

@ -202,7 +202,7 @@ public class ArrayCompareCondition implements Condition {
}
public static class Result extends Condition.Result {
private final @Nullable Map<String, Object> resolvedValues;
@Nullable private final Map<String, Object> resolvedValues;
Result(Map<String, Object> resolvedValues, boolean met) {
super(TYPE, met);

View File

@ -412,7 +412,7 @@ public class ExecutionService extends AbstractComponent {
logger.debug("executed [{}] watches from the watch history", counter);
}
private final static class StartupExecutionContext extends TriggeredExecutionContext {
private static final class StartupExecutionContext extends TriggeredExecutionContext {
public StartupExecutionContext(Watch watch, DateTime executionTime, TriggerEvent triggerEvent, TimeValue defaultThrottlePeriod) {
super(watch, executionTime, triggerEvent, defaultThrottlePeriod);

View File

@ -25,9 +25,9 @@ public class WatchExecutionResult implements ToXContent {
private final DateTime executionTime;
private final long executionDurationMs;
private final @Nullable Input.Result inputResult;
private final @Nullable Condition.Result conditionResult;
private final @Nullable Transform.Result transformResult;
@Nullable private final Input.Result inputResult;
@Nullable private final Condition.Result conditionResult;
@Nullable private final Transform.Result transformResult;
private final ExecutableActions.Results actionsResults;
public WatchExecutionResult(WatchExecutionContext context, long executionDurationMs) {

View File

@ -33,12 +33,12 @@ public class WatchRecord implements ToXContent {
// only emitted to xcontent in "debug" mode
private final Map<String, Object> vars;
private final @Nullable ExecutableInput input;
private final @Nullable Condition condition;
private final @Nullable Map<String,Object> metadata;
@Nullable private final ExecutableInput input;
@Nullable private final Condition condition;
@Nullable private final Map<String,Object> metadata;
private final @Nullable String[] messages;
private final @Nullable WatchExecutionResult executionResult;
@Nullable private final String[] messages;
@Nullable private final WatchExecutionResult executionResult;
/**
* Called when the execution was aborted before it started

View File

@ -33,8 +33,8 @@ public class HttpInput implements Input {
public static final String TYPE = "http";
private final HttpRequestTemplate request;
private final @Nullable HttpContentType expectedResponseXContentType;
private final @Nullable Set<String> extractKeys;
@Nullable private final HttpContentType expectedResponseXContentType;
@Nullable private final Set<String> extractKeys;
public HttpInput(HttpRequestTemplate request, @Nullable HttpContentType expectedResponseXContentType,
@Nullable Set<String> extractKeys) {
@ -142,7 +142,7 @@ public class HttpInput implements Input {
public static class Result extends Input.Result {
private final @Nullable HttpRequest request;
@Nullable private final HttpRequest request;
private final int statusCode;
public Result(HttpRequest request, int statusCode, Payload payload) {

View File

@ -35,7 +35,7 @@ public class ExecutableSearchInput extends ExecutableInput<SearchInput, SearchIn
private final WatcherClientProxy client;
private final WatcherSearchTemplateService searchTemplateService;
private final @Nullable TimeValue timeout;
@Nullable private final TimeValue timeout;
public ExecutableSearchInput(SearchInput input, ESLogger logger, WatcherClientProxy client,
WatcherSearchTemplateService searchTemplateService, @Nullable TimeValue defaultTimeout) {

View File

@ -38,9 +38,9 @@ public class SearchInput implements Input {
public static final String TYPE = "search";
private final WatcherSearchTemplateRequest request;
private final @Nullable Set<String> extractKeys;
private final @Nullable TimeValue timeout;
private final @Nullable DateTimeZone dynamicNameTimeZone;
@Nullable private final Set<String> extractKeys;
@Nullable private final TimeValue timeout;
@Nullable private final DateTimeZone dynamicNameTimeZone;
public SearchInput(WatcherSearchTemplateRequest request, @Nullable Set<String> extractKeys,
@Nullable TimeValue timeout, @Nullable DateTimeZone dynamicNameTimeZone) {
@ -176,7 +176,7 @@ public class SearchInput implements Input {
public static class Result extends Input.Result {
private final @Nullable SearchRequest request;
@Nullable private final SearchRequest request;
public Result(SearchRequest request, Payload payload) {
super(TYPE, payload);

View File

@ -27,9 +27,9 @@ public class Script implements ToXContent {
public static final String DEFAULT_LANG = ScriptSettings.DEFAULT_LANG;
private final String script;
private final @Nullable ScriptType type;
private final @Nullable String lang;
private final @Nullable Map<String, Object> params;
@Nullable private final ScriptType type;
@Nullable private final String lang;
@Nullable private final Map<String, Object> params;
Script(String script) {
this(script, null, null, null);
@ -189,7 +189,7 @@ public class Script implements ToXContent {
return new Builder.DefaultType(text);
}
public static abstract class Builder<B extends Builder> {
public abstract static class Builder<B extends Builder> {
protected final ScriptType type;
protected final String script;

View File

@ -102,7 +102,7 @@ public class FairKeyedLock<T> {
@SuppressWarnings("serial")
private final static class KeyLock extends ReentrantLock {
private static final class KeyLock extends ReentrantLock {
private final AtomicInteger count = new AtomicInteger(1);
public KeyLock(boolean fair) {
@ -118,7 +118,7 @@ public class FairKeyedLock<T> {
* A {@link FairKeyedLock} that allows to acquire a global lock that guarantees
* exclusive access to the resource the KeyedLock is guarding.
*/
public final static class GlobalLockable<T> extends FairKeyedLock<T> {
public static final class GlobalLockable<T> extends FairKeyedLock<T> {
private final ReadWriteLock lock = new ReentrantReadWriteLock(true);

View File

@ -36,7 +36,7 @@ import java.util.Objects;
public class WatcherSearchTemplateRequest implements ToXContent {
private final SearchRequest request;
private final @Nullable Script template;
@Nullable private final Script template;
public WatcherSearchTemplateRequest(SearchRequest searchRequest, @Nullable Script template) {
this.request = Objects.requireNonNull(searchRequest);
@ -250,5 +250,5 @@ public class WatcherSearchTemplateRequest implements ToXContent {
static final ParseField ALLOW_NO_INDICES_FIELD = new ParseField("allow_no_indices");
static final ParseField TEMPLATE_FIELD = new ParseField("template");
public final static IndicesOptions DEFAULT_INDICES_OPTIONS = IndicesOptions.lenientExpandOpen();
public static final IndicesOptions DEFAULT_INDICES_OPTIONS = IndicesOptions.lenientExpandOpen();
}

View File

@ -67,7 +67,7 @@ public class WatcherXContentParser implements XContentParser {
private final Clock clock;
private final XContentParser parser;
private final @Nullable SecretService secretService;
@Nullable private final SecretService secretService;
public WatcherXContentParser(XContentParser parser, Clock clock, @Nullable SecretService secretService) {
this.clock = clock;

View File

@ -30,8 +30,8 @@ public interface Transform extends ToXContent {
protected final String type;
protected final Status status;
protected final @Nullable Payload payload;
protected final @Nullable String reason;
@Nullable protected final Payload payload;
@Nullable protected final String reason;
public Result(String type, Payload payload) {
this.type = type;

View File

@ -26,7 +26,7 @@ public class ExecutableSearchTransform extends ExecutableTransform<SearchTransfo
protected final WatcherClientProxy client;
private final WatcherSearchTemplateService searchTemplateService;
protected final @Nullable TimeValue timeout;
@Nullable protected final TimeValue timeout;
public ExecutableSearchTransform(SearchTransform transform, ESLogger logger, WatcherClientProxy client,
WatcherSearchTemplateService searchTemplateService, @Nullable TimeValue defaultTimeout) {

View File

@ -32,8 +32,8 @@ public class SearchTransform implements Transform {
public static final String TYPE = "search";
private final WatcherSearchTemplateRequest request;
private final @Nullable TimeValue timeout;
private final @Nullable DateTimeZone dynamicNameTimeZone;
@Nullable private final TimeValue timeout;
@Nullable private final DateTimeZone dynamicNameTimeZone;
public SearchTransform(WatcherSearchTemplateRequest request, @Nullable TimeValue timeout, @Nullable DateTimeZone dynamicNameTimeZone) {
this.request = request;
@ -142,7 +142,7 @@ public class SearchTransform implements Transform {
public static class Result extends Transform.Result {
private final @Nullable SearchRequest request;
@Nullable private final SearchRequest request;
public Result(SearchRequest request, Payload payload) {
super(TYPE, payload);

View File

@ -32,8 +32,8 @@ public class ExecuteWatchRequest extends MasterNodeReadRequest<ExecuteWatchReque
private String id;
private boolean ignoreCondition = false;
private boolean recordExecution = false;
private @Nullable Map<String, Object> triggerData = null;
private @Nullable Map<String, Object> alternativeInput = null;
@Nullable private Map<String, Object> triggerData = null;
@Nullable private Map<String, Object> alternativeInput = null;
private Map<String, ActionExecutionMode> actionModes = new HashMap<>();
private BytesReference watchSource;

View File

@ -64,10 +64,10 @@ public class Watch implements TriggerEngine.Job, ToXContent {
private final Trigger trigger;
private final ExecutableInput input;
private final ExecutableCondition condition;
private final @Nullable ExecutableTransform transform;
@Nullable private final ExecutableTransform transform;
private final ExecutableActions actions;
private final @Nullable TimeValue throttlePeriod;
private final @Nullable Map<String, Object> metadata;
@Nullable private final TimeValue throttlePeriod;
@Nullable private final Map<String, Object> metadata;
private final WatchStatus status;
private final transient AtomicLong nonceCounter = new AtomicLong();

View File

@ -47,8 +47,8 @@ public class WatchStatus implements ToXContent, Streamable {
private State state;
private @Nullable DateTime lastChecked;
private @Nullable DateTime lastMetCondition;
@Nullable private DateTime lastChecked;
@Nullable private DateTime lastMetCondition;
private Map<String, ActionStatus> actions;
private volatile boolean dirty = false;

View File

@ -42,7 +42,7 @@ import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interva
*/
public class WatcherExecutorServiceBenchmark {
private final static Settings SETTINGS = Settings.builder()
private static final Settings SETTINGS = Settings.builder()
.put("xpack.security.enabled", false)
.put("cluster.name", "bench")
.put("network.host", "localhost")

View File

@ -57,7 +57,7 @@ import static org.elasticsearch.xpack.watcher.trigger.schedule.Schedules.interva
@SuppressForbidden(reason = "benchmark")
public class WatcherScheduleEngineBenchmark {
private final static Settings SETTINGS = Settings.builder()
private static final Settings SETTINGS = Settings.builder()
.put("xpack.security.enabled", false)
.put("cluster.name", "bench")
.put("script.disable_dynamic", false)