Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
maven-model-builder-3.5.4.jar - Model Builder Module
maven-model-builder-3.5.4.jar is the JAR file for Apache Maven 3.5.4 Model Builder module.
Apache Maven is a software project management and comprehension tool.
JAR File Size and Download Location:
File: 2018-06-17 19:31 177426 lib\maven-model-builder-3.5.4.jar Download: Apache Maven Website
✍: FYIcenter.com
⏎ org/apache/maven/model/building/Result.java
package org.apache.maven.model.building; /* * 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. */ import static java.util.Collections.singleton; import static org.apache.maven.model.building.ModelProblem.Severity.ERROR; import static org.apache.maven.model.building.ModelProblem.Severity.FATAL; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; /** * There are various forms of results that are represented by this class: * <ol> * <li>success - in which case only the model field is set * <li>success with warnings - model field + non-error model problems * <li>error - no model, but diagnostics * <li>error - (partial) model and diagnostics * </ol> * Could encode these variants as subclasses, but kept in one for now * * @author bbusjaeger * @param <T> */ public class Result<T> { /** * Success without warnings * * @param model */ public static <T> Result<T> success( T model ) { return success( model, Collections.<ModelProblem>emptyList() ); } /** * Success with warnings * * @param model * @param problems */ public static <T> Result<T> success( T model, Iterable<? extends ModelProblem> problems ) { assert !hasErrors( problems ); return new Result<>( false, model, problems ); } /** * Success with warnings * * @param model * @param results */ public static <T> Result<T> success( T model, Result<?>... results ) { final List<ModelProblem> problemsList = new ArrayList<>(); for ( Result<?> result1 : results ) { for ( ModelProblem modelProblem : result1.getProblems() ) { problemsList.add( modelProblem ); } } return success( model, problemsList ); } /** * Error with problems describing the cause * * @param problems */ public static <T> Result<T> error( Iterable<? extends ModelProblem> problems ) { return error( null, problems ); } public static <T> Result<T> error( T model ) { return error( model, Collections.<ModelProblem>emptyList() ); } public static <T> Result<T> error( Result<?> result ) { return error( result.getProblems() ); } public static <T> Result<T> error( Result<?>... results ) { final List<ModelProblem> problemsList = new ArrayList<>( ); for ( Result<?> result1 : results ) { for ( ModelProblem modelProblem : result1.getProblems( ) ) { problemsList.add( modelProblem ); } } return error( problemsList ); } /** * Error with partial result and problems describing the cause * * @param model * @param problems */ public static <T> Result<T> error( T model, Iterable<? extends ModelProblem> problems ) { return new Result<>( true, model, problems ); } /** * New result - determine whether error or success by checking problems for errors * * @param model * @param problems */ public static <T> Result<T> newResult( T model, Iterable<? extends ModelProblem> problems ) { return new Result<>( hasErrors( problems ), model, problems ); } /** * New result consisting of given result and new problem. Convenience for newResult(result.get(), * concat(result.getProblems(),problems)). * * @param result * @param problem */ public static <T> Result<T> addProblem( Result<T> result, ModelProblem problem ) { return addProblems( result, singleton( problem ) ); } /** * New result that includes the given * * @param result * @param problems */ public static <T> Result<T> addProblems( Result<T> result, Iterable<? extends ModelProblem> problems ) { Collection<ModelProblem> list = new ArrayList<>(); for ( ModelProblem item : problems ) { list.add( item ); } for ( ModelProblem item : result.getProblems() ) { list.add( item ); } return new Result<>( result.hasErrors() || hasErrors( problems ), result.get(), list ); } public static <T> Result<T> addProblems( Result<T> result, Result<?>... results ) { final List<ModelProblem> problemsList = new ArrayList<>(); for ( Result<?> result1 : results ) { for ( ModelProblem modelProblem : result1.getProblems( ) ) { problemsList.add( modelProblem ); } } return addProblems( result, problemsList ); } /** * Turns the given results into a single result by combining problems and models into single collection. * * @param results */ public static <T> Result<Iterable<T>> newResultSet( Iterable<? extends Result<? extends T>> results ) { boolean hasErrors = false; List<T> modelsList = new ArrayList<>(); List<ModelProblem> problemsList = new ArrayList<>(); for ( Result<? extends T> result : results ) { modelsList.add( result.get() ); for ( ModelProblem modelProblem : result.getProblems() ) { problemsList.add( modelProblem ); } if ( result.hasErrors() ) { hasErrors = true; } } return new Result<>( hasErrors, ( Iterable<T> ) modelsList, problemsList ); } // helper to determine if problems contain error private static boolean hasErrors( Iterable<? extends ModelProblem> problems ) { for ( ModelProblem input : problems ) { if ( input.getSeverity().equals( ERROR ) || input.getSeverity().equals( FATAL ) ) { return true; } } return false; } /** * Class definition */ private final boolean errors; private final T value; private final Iterable<? extends ModelProblem> problems; private Result( boolean errors, T model, Iterable<? extends ModelProblem> problems ) { this.errors = errors; this.value = model; this.problems = problems; } public Iterable<? extends ModelProblem> getProblems() { return problems; } public T get() { return value; } public boolean hasErrors() { return errors; } }
⏎ org/apache/maven/model/building/Result.java
Or download all of them as a single archive file:
File name: maven-model-builder-3.5.4-src.zip File size: 146807 bytes Release date: 2018-06-17 Download
⇐ maven-settings-builder-3.5.4.jar - Maven Settings Builder Module
2023-06-19, 13195👍, 0💬
Popular Posts:
Woodstox 6.4.0 Source Code Files are provided at the Woodstox GitHub Website . You can download them...
JDK 11 java.xml.crypto.jmod is the JMOD file for JDK 11 XML (eXtensible Markup Language) Crypto modu...
JLayer is a library that decodes/plays/converts MPEG 1/2/2.5 Layer 1/2/3 (i.e. MP3) in real time for...
The Web Services Description Language for Java Toolkit (WSDL4J), Release 1.6.2, allows the creation,...
JDK 11 jdk.scripting.nashorn.jm odis the JMOD file for JDK 11 Scripting Nashorn module. JDK 11 Scrip...