mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-20 14:10:44 +00:00
Eliminated all warnings.
This commit is contained in:
@ -279,7 +279,9 @@ public class ChildRecordListRenderer extends AbstractWidgetRenderer
|
||||
Map<String, Serializable> widgetValues = input.getWidgetMetaData().getDefaultValues();
|
||||
if(widgetValues.containsKey("disabledFieldsForNewChildRecords"))
|
||||
{
|
||||
widgetData.setDisabledFieldsForNewChildRecords((Set<String>) widgetValues.get("disabledFieldsForNewChildRecords"));
|
||||
@SuppressWarnings("unchecked")
|
||||
Set<String> disabledFieldsForNewChildRecords = (Set<String>) widgetValues.get("disabledFieldsForNewChildRecords");
|
||||
widgetData.setDisabledFieldsForNewChildRecords(disabledFieldsForNewChildRecords);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ public class StreamedSheetWriter
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Integer> m = new HashMap();
|
||||
Map<String, Integer> m = new HashMap<>();
|
||||
m.computeIfAbsent("s", (s) -> 3);
|
||||
|
||||
value = rs.toString();
|
||||
|
@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.core.actions.scripts;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import com.kingsrook.qqq.backend.core.actions.scripts.logging.BuildScriptLogAndScriptLogLineExecutionLogger;
|
||||
@ -97,7 +98,7 @@ public class RecordScriptTestInterface implements TestScriptActionInterface
|
||||
}
|
||||
|
||||
QueryOutput queryOutput = new QueryAction().execute(new QueryInput(tableName)
|
||||
.withFilter(new QQueryFilter(new QFilterCriteria(table.getPrimaryKeyField(), QCriteriaOperator.IN, recordPrimaryKeyList.split(","))))
|
||||
.withFilter(new QQueryFilter(new QFilterCriteria(table.getPrimaryKeyField(), QCriteriaOperator.IN, Arrays.stream(recordPrimaryKeyList.split(",")).toList())))
|
||||
.withIncludeAssociations(true));
|
||||
if(CollectionUtils.nullSafeIsEmpty(queryOutput.getRecords()))
|
||||
{
|
||||
|
@ -154,8 +154,9 @@ public class RunAdHocRecordScriptAction
|
||||
Method qRecordListToApiRecordList = apiScriptUtilsClass.getMethod("qRecordListToApiRecordList", List.class, String.class, String.class, String.class);
|
||||
Object apiRecordList = qRecordListToApiRecordList.invoke(null, input.getRecordList(), input.getTableName(), scriptRevision.getApiName(), scriptRevision.getApiVersion());
|
||||
|
||||
// noinspection unchecked
|
||||
return (ArrayList<? extends Serializable>) apiRecordList;
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<? extends Serializable> rs = (ArrayList<? extends Serializable>) apiRecordList;
|
||||
return rs;
|
||||
}
|
||||
catch(ClassNotFoundException e)
|
||||
{
|
||||
|
@ -563,6 +563,7 @@ public class QValueFormatter
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// heavy fields that weren't fetched - they should have a backend-detail specifying their length (or null if null) //
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Serializable> heavyFieldLengths = (Map<String, Serializable>) record.getBackendDetail(QRecord.BACKEND_DETAILS_TYPE_HEAVY_FIELD_LENGTHS);
|
||||
if(heavyFieldLengths != null)
|
||||
{
|
||||
|
@ -300,6 +300,7 @@ public class SearchPossibleValueSourceAction
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
private SearchPossibleValueSourceOutput searchPossibleValueCustom(SearchPossibleValueSourceInput input, QPossibleValueSource possibleValueSource)
|
||||
{
|
||||
try
|
||||
|
@ -922,7 +922,7 @@ public class QInstanceValidator
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
private <T extends FieldBehavior<T>> void validateTableField(QInstance qInstance, String tableName, String fieldName, QTableMetaData table, QFieldMetaData field)
|
||||
private void validateTableField(QInstance qInstance, String tableName, String fieldName, QTableMetaData table, QFieldMetaData field)
|
||||
{
|
||||
assertCondition(Objects.equals(fieldName, field.getName()),
|
||||
"Inconsistent naming in table " + tableName + " for field " + fieldName + "/" + field.getName() + ".");
|
||||
@ -944,12 +944,13 @@ public class QInstanceValidator
|
||||
assertCondition(field.getMaxLength() != null, prefix + "specifies a ValueTooLongBehavior, but not a maxLength.");
|
||||
}
|
||||
|
||||
Set<Class<FieldBehavior<T>>> usedFieldBehaviorTypes = new HashSet<>();
|
||||
Set<Class<FieldBehavior<?>>> usedFieldBehaviorTypes = new HashSet<>();
|
||||
if(field.getBehaviors() != null)
|
||||
{
|
||||
for(FieldBehavior<?> fieldBehavior : field.getBehaviors())
|
||||
{
|
||||
Class<FieldBehavior<T>> behaviorClass = (Class<FieldBehavior<T>>) fieldBehavior.getClass();
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<FieldBehavior<?>> behaviorClass = (Class<FieldBehavior<?>>) fieldBehavior.getClass();
|
||||
|
||||
errors.addAll(fieldBehavior.validateBehaviorConfiguration(table, field));
|
||||
|
||||
|
@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.core.instances;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import com.amazonaws.auth.AWSStaticCredentialsProvider;
|
||||
@ -113,7 +114,7 @@ public class SecretsManagerUtils
|
||||
dotEnv.renameTo(new File(".env.backup-" + System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
FileUtils.writeStringToFile(dotEnv, fullEnv.toString());
|
||||
FileUtils.writeStringToFile(dotEnv, fullEnv.toString(), StandardCharsets.UTF_8);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -40,11 +40,14 @@ public abstract class AbstractFilterExpression<T extends Serializable> implement
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Evaluate the expression, given a map of input values.
|
||||
**
|
||||
** By default, this will defer to the evaluate(void) method - but, a subclass
|
||||
** (e.g., FilterVariableExpression) may react differently.
|
||||
*******************************************************************************/
|
||||
public T evaluateInputValues(Map<String, Serializable> inputValues) throws QException
|
||||
{
|
||||
return (T) this;
|
||||
return evaluate();
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,10 +79,11 @@ public class QFilterCriteriaDeserializer extends StdDeserializer<QFilterCriteria
|
||||
/////////////////////////////////
|
||||
// get values out of json node //
|
||||
/////////////////////////////////
|
||||
List<Serializable> values = objectMapper.treeToValue(node.get("values"), List.class);
|
||||
String fieldName = objectMapper.treeToValue(node.get("fieldName"), String.class);
|
||||
QCriteriaOperator operator = objectMapper.treeToValue(node.get("operator"), QCriteriaOperator.class);
|
||||
String otherFieldName = objectMapper.treeToValue(node.get("otherFieldName"), String.class);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Serializable> values = objectMapper.treeToValue(node.get("values"), List.class);
|
||||
String fieldName = objectMapper.treeToValue(node.get("fieldName"), String.class);
|
||||
QCriteriaOperator operator = objectMapper.treeToValue(node.get("operator"), QCriteriaOperator.class);
|
||||
String otherFieldName = objectMapper.treeToValue(node.get("otherFieldName"), String.class);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// look at all the values - if any of them are actually meant to be an Expression (instance of subclass of AbstractFilterExpression) //
|
||||
|
@ -74,6 +74,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withTooltip(S key, String value)
|
||||
{
|
||||
addTooltip(key, value);
|
||||
@ -99,6 +100,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withTooltip(S key, BlockTooltip value)
|
||||
{
|
||||
addTooltip(key, value);
|
||||
@ -144,6 +146,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
/*******************************************************************************
|
||||
** Fluent setter for tooltipMap
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withTooltipMap(Map<S, BlockTooltip> tooltipMap)
|
||||
{
|
||||
this.tooltipMap = tooltipMap;
|
||||
@ -178,6 +181,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
** Fluent setter for tooltip
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withTooltip(String tooltip)
|
||||
{
|
||||
this.tooltip = new BlockTooltip(tooltip);
|
||||
@ -190,6 +194,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
** Fluent setter for tooltip
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withTooltip(BlockTooltip tooltip)
|
||||
{
|
||||
this.tooltip = tooltip;
|
||||
@ -201,6 +206,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withLink(S key, String value)
|
||||
{
|
||||
addLink(key, value);
|
||||
@ -226,6 +232,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withLink(S key, BlockLink value)
|
||||
{
|
||||
addLink(key, value);
|
||||
@ -271,6 +278,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
/*******************************************************************************
|
||||
** Fluent setter for linkMap
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withLinkMap(Map<S, BlockLink> linkMap)
|
||||
{
|
||||
this.linkMap = linkMap;
|
||||
@ -305,6 +313,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
** Fluent setter for link
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withLink(String link)
|
||||
{
|
||||
this.link = new BlockLink(link);
|
||||
@ -317,6 +326,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
** Fluent setter for link
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withLink(BlockLink link)
|
||||
{
|
||||
this.link = link;
|
||||
@ -348,6 +358,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
/*******************************************************************************
|
||||
** Fluent setter for values
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withValues(V values)
|
||||
{
|
||||
this.values = values;
|
||||
@ -379,6 +390,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
/*******************************************************************************
|
||||
** Fluent setter for styles
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withStyles(SX styles)
|
||||
{
|
||||
this.styles = styles;
|
||||
@ -409,6 +421,7 @@ public abstract class AbstractBlockWidgetData<
|
||||
/*******************************************************************************
|
||||
** Fluent setter for blockId
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T withBlockId(String blockId)
|
||||
{
|
||||
this.blockId = blockId;
|
||||
|
@ -192,6 +192,7 @@ public abstract class QRecordEntity
|
||||
|
||||
for(QRecordEntityAssociation qRecordEntityAssociation : getAssociationList(this.getClass()))
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
List<? extends QRecordEntity> associatedEntities = (List<? extends QRecordEntity>) qRecordEntityAssociation.getGetter().invoke(this);
|
||||
String associationName = qRecordEntityAssociation.getAssociationAnnotation().name();
|
||||
|
||||
@ -245,6 +246,7 @@ public abstract class QRecordEntity
|
||||
|
||||
for(QRecordEntityAssociation qRecordEntityAssociation : getAssociationList(this.getClass()))
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
List<? extends QRecordEntity> associatedEntities = (List<? extends QRecordEntity>) qRecordEntityAssociation.getGetter().invoke(this);
|
||||
String associationName = qRecordEntityAssociation.getAssociationAnnotation().name();
|
||||
|
||||
@ -346,6 +348,7 @@ public abstract class QRecordEntity
|
||||
|
||||
if(associationAnnotation.isPresent())
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends QRecordEntity> listTypeParam = (Class<? extends QRecordEntity>) getListTypeParam(possibleGetter.getReturnType(), possibleGetter.getAnnotatedReturnType());
|
||||
associationList.add(new QRecordEntityAssociation(fieldName, possibleGetter, setter.get(), listTypeParam, associationAnnotation.orElse(null)));
|
||||
}
|
||||
|
@ -188,7 +188,8 @@ public class FieldAdornment
|
||||
** Fluent setter for values
|
||||
**
|
||||
*******************************************************************************/
|
||||
public FieldAdornment withValues(Pair<String, Serializable>... values)
|
||||
@SafeVarargs
|
||||
public final FieldAdornment withValues(Pair<String, Serializable>... values)
|
||||
{
|
||||
for(Pair<String, Serializable> value : values)
|
||||
{
|
||||
|
@ -804,7 +804,7 @@ public class QTableMetaData implements QAppChildMetaData, Serializable, MetaData
|
||||
{
|
||||
if(this.associatedScripts == null)
|
||||
{
|
||||
this.associatedScripts = new ArrayList();
|
||||
this.associatedScripts = new ArrayList<>();
|
||||
}
|
||||
this.associatedScripts.add(associatedScript);
|
||||
return (this);
|
||||
|
@ -662,7 +662,11 @@ public class MemoryRecordStore
|
||||
{
|
||||
return (-1);
|
||||
}
|
||||
return ((Comparable) a).compareTo(b);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Comparable<Serializable> comparableSerializableA = (Comparable<Serializable>) a;
|
||||
|
||||
return comparableSerializableA.compareTo(b);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -769,6 +773,7 @@ public class MemoryRecordStore
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
private static Serializable computeAggregate(List<QRecord> records, Aggregate aggregate, QTableMetaData table)
|
||||
{
|
||||
String fieldName = aggregate.getFieldName();
|
||||
|
@ -65,9 +65,14 @@ public class MergeDuplicatesLoadStep extends LoadViaInsertOrUpdateStep
|
||||
{
|
||||
super.runOnePage(runBackendStepInput, runBackendStepOutput);
|
||||
|
||||
ListingHash<String, Serializable> otherTableIdsToDelete = (ListingHash<String, Serializable>) runBackendStepInput.getValue("otherTableIdsToDelete");
|
||||
@SuppressWarnings("unchecked")
|
||||
ListingHash<String, Serializable> otherTableIdsToDelete = (ListingHash<String, Serializable>) runBackendStepInput.getValue("otherTableIdsToDelete");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ListingHash<String, QQueryFilter> otherTableFiltersToDelete = (ListingHash<String, QQueryFilter>) runBackendStepInput.getValue("otherTableFiltersToDelete");
|
||||
ListingHash<String, QRecord> otherTableRecordsToStore = (ListingHash<String, QRecord>) runBackendStepInput.getValue("otherTableRecordsToStore");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ListingHash<String, QRecord> otherTableRecordsToStore = (ListingHash<String, QRecord>) runBackendStepInput.getValue("otherTableRecordsToStore");
|
||||
|
||||
if(otherTableIdsToDelete != null)
|
||||
{
|
||||
|
@ -114,8 +114,9 @@ public class PrepareReportForRecordStep extends PrepareReportStep
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// if there are no more input fields, then remove the INPUT step from the process. //
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
inputFieldList = (ArrayList<QFieldMetaData>) runBackendStepOutput.getValue("inputFieldList");
|
||||
if(!CollectionUtils.nullSafeHasContents(inputFieldList))
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<QFieldMetaData> updatedInputFieldList = (ArrayList<QFieldMetaData>) runBackendStepOutput.getValue("inputFieldList");
|
||||
if(!CollectionUtils.nullSafeHasContents(updatedInputFieldList))
|
||||
{
|
||||
removeInputStepFromProcess(runBackendStepOutput);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class TestScriptProcessStep implements BackendStep
|
||||
//////////////////////////////////
|
||||
// send script outputs back out //
|
||||
//////////////////////////////////
|
||||
output.addValue("scriptLogLines", CollectionUtils.useOrWrap(testScriptOutput.getScriptLogLines(), TypeToken.get(ArrayList.class)));
|
||||
output.addValue("scriptLogLines", CollectionUtils.useOrWrap(testScriptOutput.getScriptLogLines(), new TypeToken<ArrayList<QRecord>>() {}));
|
||||
output.addValue("outputObject", testScriptOutput.getOutputObject());
|
||||
|
||||
if(testScriptOutput.getException() != null)
|
||||
|
@ -70,7 +70,9 @@ public class QuartzJobRunner implements Job
|
||||
QContext.init(qInstance, quartzScheduler.getSessionSupplier().get());
|
||||
|
||||
schedulableType = qInstance.getSchedulableType(context.getJobDetail().getJobDataMap().getString("type"));
|
||||
params = (Map<String, Object>) context.getJobDetail().getJobDataMap().get("params");
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> paramsFromJobDataMap = (Map<String, Object>) context.getJobDetail().getJobDataMap().get("params");
|
||||
params = paramsFromJobDataMap;
|
||||
|
||||
SchedulableRunner schedulableRunner = QCodeLoader.getAdHoc(SchedulableRunner.class, schedulableType.getRunner());
|
||||
|
||||
|
@ -74,7 +74,9 @@ public class SchedulableProcessRunner implements SchedulableRunner
|
||||
Map<String, Serializable> backendVariantData = null;
|
||||
if(params.containsKey("backendVariantData"))
|
||||
{
|
||||
backendVariantData = (Map<String, Serializable>) params.get("backendVariantData");
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Serializable> dataFromMap = (Map<String, Serializable>) params.get("backendVariantData");
|
||||
backendVariantData = dataFromMap;
|
||||
}
|
||||
|
||||
Map<String, Serializable> processInputValues = buildProcessInputValuesMap(params, process);
|
||||
|
@ -26,6 +26,7 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
@ -78,7 +79,7 @@ public class TempFileStateProvider implements StateProviderInterface
|
||||
try
|
||||
{
|
||||
String json = JsonUtils.toJson(data);
|
||||
FileUtils.writeStringToFile(getFile(key), json);
|
||||
FileUtils.writeStringToFile(getFile(key), json, StandardCharsets.UTF_8);
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
@ -97,7 +98,7 @@ public class TempFileStateProvider implements StateProviderInterface
|
||||
{
|
||||
try
|
||||
{
|
||||
String json = FileUtils.readFileToString(getFile(key));
|
||||
String json = FileUtils.readFileToString(getFile(key), StandardCharsets.UTF_8);
|
||||
return (Optional.of(JsonUtils.toObject(json, type)));
|
||||
}
|
||||
catch(FileNotFoundException | NoSuchFileException fnfe)
|
||||
|
@ -50,7 +50,7 @@ public class CollectionUtils
|
||||
** true if c is null or it's empty
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static boolean nullSafeIsEmpty(Collection c)
|
||||
public static boolean nullSafeIsEmpty(Collection<?> c)
|
||||
{
|
||||
if(c == null || c.isEmpty())
|
||||
{
|
||||
@ -66,7 +66,7 @@ public class CollectionUtils
|
||||
** true if c is null or it's empty
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static boolean nullSafeIsEmpty(Map c)
|
||||
public static boolean nullSafeIsEmpty(Map<?, ?> c)
|
||||
{
|
||||
if(c == null || c.isEmpty())
|
||||
{
|
||||
@ -82,7 +82,7 @@ public class CollectionUtils
|
||||
** true if c is NOT null and it's not empty
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static boolean nullSafeHasContents(Collection c)
|
||||
public static boolean nullSafeHasContents(Collection<?> c)
|
||||
{
|
||||
return (!nullSafeIsEmpty(c));
|
||||
}
|
||||
@ -93,7 +93,7 @@ public class CollectionUtils
|
||||
** true if c is NOT null and it's not empty
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static boolean nullSafeHasContents(Map c)
|
||||
public static boolean nullSafeHasContents(Map<?, ?> c)
|
||||
{
|
||||
return (!nullSafeIsEmpty(c));
|
||||
}
|
||||
@ -104,7 +104,7 @@ public class CollectionUtils
|
||||
** 0 if c is empty, otherwise, its size.
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static int nullSafeSize(Collection c)
|
||||
public static int nullSafeSize(Collection<?> c)
|
||||
{
|
||||
if(c == null)
|
||||
{
|
||||
@ -120,7 +120,7 @@ public class CollectionUtils
|
||||
** 0 if c is empty, otherwise, its size.
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static int nullSafeSize(Map c)
|
||||
public static int nullSafeSize(Map<?, ?> c)
|
||||
{
|
||||
if(c == null)
|
||||
{
|
||||
@ -302,14 +302,14 @@ public class CollectionUtils
|
||||
return (rs);
|
||||
}
|
||||
|
||||
List<T> currentPage = new LinkedList<T>();
|
||||
List<T> currentPage = new LinkedList<>();
|
||||
rs.add(currentPage);
|
||||
|
||||
for(T value : values)
|
||||
{
|
||||
if(currentPage.size() >= pageSize)
|
||||
{
|
||||
currentPage = new LinkedList<T>();
|
||||
currentPage = new LinkedList<>();
|
||||
rs.add(currentPage);
|
||||
}
|
||||
|
||||
@ -423,6 +423,7 @@ public class CollectionUtils
|
||||
**
|
||||
** Meant to help avoid null checks on foreach loops.
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T[] nonNullArray(T[] array)
|
||||
{
|
||||
if(array == null)
|
||||
@ -539,7 +540,7 @@ public class CollectionUtils
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public static Map objectToMap(Object o)
|
||||
public static Map<?, ?> objectToMap(Object o)
|
||||
{
|
||||
ObjectMapper mapper = new ObjectMapper()
|
||||
.registerModule(new JavaTimeModule())
|
||||
@ -555,6 +556,7 @@ public class CollectionUtils
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SafeVarargs
|
||||
public static <T> List<T> mergeLists(List<T>... lists)
|
||||
{
|
||||
List<T> rs = new ArrayList<>();
|
||||
@ -593,6 +595,7 @@ public class CollectionUtils
|
||||
return (null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<T> targetClass = (Class<T>) typeToken.getRawType();
|
||||
if(targetClass.isInstance(collection))
|
||||
{
|
||||
@ -630,6 +633,7 @@ public class CollectionUtils
|
||||
return (null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<T> targetClass = (Class<T>) typeToken.getRawType();
|
||||
if(targetClass.isInstance(collection))
|
||||
{
|
||||
|
@ -37,6 +37,7 @@ public class ObjectUtils
|
||||
/*******************************************************************************
|
||||
** A varargs version of Objects.requireNonNullElse
|
||||
*******************************************************************************/
|
||||
@SafeVarargs
|
||||
public static <T> T requireNonNullElse(T... objects)
|
||||
{
|
||||
if(objects == null)
|
||||
|
@ -888,6 +888,7 @@ public class ValueUtils
|
||||
** Return the first argument that isn't null.
|
||||
** If all were null, return null.
|
||||
*******************************************************************************/
|
||||
@SafeVarargs
|
||||
public static <T> T getFirstNonNull(T... ts)
|
||||
{
|
||||
if(ts == null || ts.length == 0)
|
||||
|
@ -48,7 +48,11 @@ public class YamlUtils
|
||||
{
|
||||
ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory());
|
||||
objectMapper.findAndRegisterModules();
|
||||
return (objectMapper.readValue(yaml, Map.class));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> map = objectMapper.readValue(yaml, Map.class);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class AlphaNumericComparator implements Comparator<String>
|
||||
////////////////////////////////////////////////////////////////
|
||||
if(INT_PATTERN.matcher(a).matches() && INT_PATTERN.matcher(b).matches())
|
||||
{
|
||||
int intsCompared = new Integer(a).compareTo(new Integer(b));
|
||||
int intsCompared = Integer.valueOf(a).compareTo(Integer.valueOf(b));
|
||||
if(intsCompared == TIE)
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -119,7 +119,7 @@ public class AlphaNumericComparator implements Comparator<String>
|
||||
/////////////////////////////////////////////////////////////
|
||||
// if the ints compare as non-zero, return that comparison //
|
||||
/////////////////////////////////////////////////////////////
|
||||
int intPartCompared = new Integer(aIntPart).compareTo(new Integer(bIntPart));
|
||||
int intPartCompared = Integer.valueOf(aIntPart).compareTo(Integer.valueOf(bIntPart));
|
||||
if(intPartCompared != TIE)
|
||||
{
|
||||
return (intPartCompared);
|
||||
|
@ -87,7 +87,9 @@ public class MultiLevelMapHelper
|
||||
{
|
||||
try
|
||||
{
|
||||
return (map.getClass().getConstructor().newInstance());
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<K2, V> map1 = map.getClass().getConstructor().newInstance();
|
||||
return map1;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user