All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.qwazr.compiler.CompilerStatus Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
/**
 * Copyright 2016 Emmanuel Keller / QWAZR
 * 

* Licensed 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 com.qwazr.compiler; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import javax.tools.Diagnostic; import java.net.URI; import java.util.Date; import java.util.LinkedHashSet; import java.util.Locale; import java.util.Map; import java.util.SortedMap; import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; @JsonInclude(JsonInclude.Include.NON_EMPTY) public class CompilerStatus { public final SortedMap compilables; public final SortedMap diagnostics; public final SortedSet classPath; @JsonCreator public CompilerStatus(@JsonProperty("compilables") final Map compilables, @JsonProperty("diagnostics") final Map diagnostics, @JsonProperty("classPath") final LinkedHashSet classPath) { this.compilables = new TreeMap<>(compilables); this.diagnostics = new TreeMap<>(diagnostics); this.classPath = classPath == null ? null : new TreeSet<>(classPath); } public static class DiagnosticStatus { public final Date date; public final String code; public final Diagnostic.Kind kind; public final Long lineNumber; public final Long columnNumber; public final String message; @JsonCreator private DiagnosticStatus(@JsonProperty("date") final Date date, @JsonProperty("code") final String code, @JsonProperty("kind") final Diagnostic.Kind kind, @JsonProperty("lineNumber") final Long lineNumber, @JsonProperty("columnNumber") final Long columnNumber, @JsonProperty("message") final String message) { this.date = date; this.code = code; this.kind = kind; this.lineNumber = lineNumber; this.columnNumber = columnNumber; this.message = message; } public DiagnosticStatus(final Date date, final Diagnostic diagnostic) { this(date, diagnostic.getCode(), diagnostic.getKind(), diagnostic.getLineNumber(), diagnostic.getColumnNumber(), diagnostic.getMessage(Locale.getDefault())); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy