Example usage for java.util Collections EMPTY_LIST

List of usage examples for java.util Collections EMPTY_LIST

Introduction

In this page you can find the example usage for java.util Collections EMPTY_LIST.

Prototype

List EMPTY_LIST

To view the source code for java.util Collections EMPTY_LIST.

Click Source Link

Document

The empty list (immutable).

Usage

From source file:com.adobe.acs.commons.util.ResourceUtil.java

/**
 * Convenience method for getting a multi-value String property from a resource.
 *
 * @param resource The resource from which to get the property.
 * @param namePattern Property name.//www  .  j  a v  a  2  s.com
 * @return Property values.
 */
public static List<String> getPropertyStrings(Resource resource, String namePattern) {
    String[] vals = resource.getValueMap().get(namePattern, String[].class);
    return vals != null ? Arrays.asList(vals) : Collections.EMPTY_LIST;
}

From source file:hydrograph.ui.graph.execution.tracking.connection.HydrographServerConnection.java

/**
 * Gets the status req./*from  w w  w . ja va2s  .c o  m*/
 *
 * @param jobID the job id
 * @return the status req
 */
private String getStatusReq(String jobID) {
    ExecutionStatus executionStatus = new ExecutionStatus(Collections.EMPTY_LIST);
    executionStatus.setJobId(jobID);
    executionStatus.setType("get");
    executionStatus.setClientId("ui-client");
    Gson gson = new Gson();
    return gson.toJson(executionStatus);
}

From source file:com.espertech.esper.event.xml.SimpleXMLEventType.java

/**
 * Ctor./*from  ww w .  j a v a  2 s  . c  om*/
 * @param configurationEventTypeXMLDOM configures the event type
 * @param eventTypeMetadata event type metadata
 * @param eventAdapterService for type looking and registration
 */
public SimpleXMLEventType(EventTypeMetadata eventTypeMetadata, int eventTypeId,
        ConfigurationEventTypeXMLDOM configurationEventTypeXMLDOM, EventAdapterService eventAdapterService) {
    super(eventTypeMetadata, eventTypeId, configurationEventTypeXMLDOM, eventAdapterService);
    isResolvePropertiesAbsolute = configurationEventTypeXMLDOM.isXPathResolvePropertiesAbsolute();
    propertyGetterCache = new HashMap<String, EventPropertyGetter>();

    // Set of namespace context for XPath expressions
    XPathNamespaceContext xPathNamespaceContext = new XPathNamespaceContext();
    for (Map.Entry<String, String> entry : configurationEventTypeXMLDOM.getNamespacePrefixes().entrySet()) {
        xPathNamespaceContext.addPrefix(entry.getKey(), entry.getValue());
    }
    if (configurationEventTypeXMLDOM.getDefaultNamespace() != null) {
        String defaultNamespace = configurationEventTypeXMLDOM.getDefaultNamespace();
        xPathNamespaceContext.setDefaultNamespace(defaultNamespace);

        // determine a default namespace prefix to use to construct XPath expressions from pure property names
        defaultNamespacePrefix = null;
        for (Map.Entry<String, String> entry : configurationEventTypeXMLDOM.getNamespacePrefixes().entrySet()) {
            if (entry.getValue().equals(defaultNamespace)) {
                defaultNamespacePrefix = entry.getKey();
                break;
            }
        }
    }
    super.setNamespaceContext(xPathNamespaceContext);
    super.initialize(configurationEventTypeXMLDOM.getXPathProperties().values(), Collections.EMPTY_LIST);
}

From source file:net.lightbody.bmp.proxy.jetty.jetty.servlet.Holder.java

public Enumeration getInitParameterNames() {
    if (_initParams == null)
        return Collections.enumeration(Collections.EMPTY_LIST);
    return Collections.enumeration(_initParams.keySet());
}

From source file:HashCodeAssist.java

/**
 * <p>/*from  www.  ja v  a  2s .co m*/
 * Appends the fields and values defined by the given object of the given
 * <code>Class</code>.
 * </p>
 * 
 * @param object
 *            the object to append details of
 * @param clazz
 *            the class to append details of
 * @param builder
 *            the builder to append to
 * @param useTransients
 *            whether to use transient fields
 * @param excludeFields
 *            Collection of String field names to exclude from use in
 *            calculation of hash code
 */
private static void reflectionAppend(Object object, Class<?> clazz, HashCodeAssist builder,
        boolean useTransients, String... excludeFields) {
    if (isRegistered(object)) {
        return;
    }
    try {
        register(object);
        Field[] fields = clazz.getDeclaredFields();
        List<String> excludedFieldList = excludeFields != null ? Arrays.asList(excludeFields)
                : Collections.EMPTY_LIST;
        AccessibleObject.setAccessible(fields, true);
        for (int i = 0; i < fields.length; i++) {
            Field field = fields[i];
            if (!excludedFieldList.contains(field.getName()) && (field.getName().indexOf('$') == -1)
                    && (useTransients || !Modifier.isTransient(field.getModifiers()))
                    && (!Modifier.isStatic(field.getModifiers()))) {
                try {
                    Object fieldValue = field.get(object);
                    builder.append(fieldValue);
                } catch (IllegalAccessException e) {
                    // this can't happen. Would get a Security exception
                    // instead
                    // throw a runtime exception in case the impossible
                    // happens.
                    throw new InternalError("Unexpected IllegalAccessException");
                }
            }
        }
    } finally {
        unregister(object);
    }
}

From source file:de.hybris.platform.integration.cis.avs.impl.DefaultCisAddressVerificationService.java

@Override
public AddressVerificationResultData<AddressVerificationDecision, AddressFieldErrorData<AddressFieldType, AddressErrorCode>> verifyAddress(
        final AddressModel addressModel) {
    //Only apply the verification strategy on certain addresses
    if (!getApplyVerificationStrategy().isVerificationRequired(addressModel)) {
        final AddressVerificationResultData<AddressVerificationDecision, AddressFieldErrorData<AddressFieldType, AddressErrorCode>> verifiedResult = createVerificationResult();
        verifiedResult.setDecision(AddressVerificationDecision.ACCEPT);
        verifiedResult.setSuggestedAddresses(Collections.EMPTY_LIST);
        return verifiedResult;
    }/*from w  w  w  .  j  a v a 2s.c  o m*/

    final CisAddress cisAddress = getCisAvsAddressConverter().convert(addressModel);

    // Wrap the verifyAddress call to CIS with Hystrix
    final AvsResult avsResult = getOndemandHystrixCommandFactory()
            .newCommand(getHystrixCommandConfig(), new HystrixExecutable<AvsResult>() {
                @Override
                public AvsResult runEvent() {
                    final RestResponse<AvsResult> avsResultRestResponse = getAvsClient()
                            .verifyAddress(getClientRef(), cisAddress);
                    Assert.notNull(avsResultRestResponse, "AvsClient returned a null RestResponse");
                    return avsResultRestResponse.getResult();
                }

                @Override
                public AvsResult fallbackEvent() {
                    return null;
                }

                @Override
                public AvsResult defaultEvent() {
                    return null;
                }

            }).execute();

    if (avsResult == null) {
        // The Hystrix fallback command was called, therefore result is UNKNOWN.
        final AddressVerificationResultData<AddressVerificationDecision, AddressFieldErrorData<AddressFieldType, AddressErrorCode>> verifiedResult = createVerificationResult();
        verifiedResult.setDecision(AddressVerificationDecision.UNKNOWN);
        return verifiedResult;
    }

    removeVerifiedAddressFromSuggestedAddresses(cisAddress, avsResult.getSuggestedAddresses());

    final AddressVerificationResultData verificationResultData = getCisAvsResultAddressVerificationResultDataConverter()
            .convert(avsResult);

    //set first name, last name on the suggested addresses
    if (CollectionUtils.isNotEmpty(verificationResultData.getSuggestedAddresses())) {
        getCisAvsAddressMatchingPopulator().populate(addressModel, verificationResultData);
    }

    return verificationResultData;
}

From source file:com.creactiviti.piper.core.Coordinator.java

/**
 * Starts a job instance./*  w w  w.j av a2s.  co m*/
 * 
 * @param aJobParams
 *          The Key-Value map representing the job
 *          parameters
 * @return Job
 *           The instance of the Job
 */
public Job create(Map<String, Object> aJobParams) {
    Assert.notNull(aJobParams, "request can't be null");
    MapObject jobParams = MapObject.of(aJobParams);
    String pipelineId = jobParams.getRequiredString(PIPELINE_ID);
    Pipeline pipeline = pipelineRepository.findOne(pipelineId);
    Assert.notNull(pipeline, String.format("Unkown pipeline: %s", pipelineId));
    Assert.isNull(pipeline.getError(),
            pipeline.getError() != null ? String.format("%s: %s", pipelineId, pipeline.getError().getMessage())
                    : null);

    validate(jobParams, pipeline);

    MapObject inputs = MapObject.of(jobParams.getMap(INPUTS, Collections.EMPTY_MAP));
    List<Accessor> webhooks = jobParams.getList(WEBHOOKS, MapObject.class, Collections.EMPTY_LIST);
    List<String> tags = (List<String>) aJobParams.get(TAGS);

    SimpleJob job = new SimpleJob();
    job.setId(UUIDGenerator.generate());
    job.setLabel(jobParams.getString(DSL.LABEL, pipeline.getLabel()));
    job.setPriority(jobParams.getInteger(DSL.PRIORITY, Prioritizable.DEFAULT_PRIORITY));
    job.setPipelineId(pipeline.getId());
    job.setStatus(JobStatus.CREATED);
    job.setCreateTime(new Date());
    job.setParentTaskExecutionId((String) aJobParams.get(DSL.PARENT_TASK_EXECUTION_ID));
    job.setTags(tags != null ? tags.toArray(new String[tags.size()]) : new String[0]);
    job.setWebhooks(webhooks != null ? webhooks : Collections.EMPTY_LIST);
    job.setInputs(inputs);
    log.debug("Job {} started", job.getId());
    jobRepository.create(job);

    MapContext context = new MapContext(jobParams.getMap(INPUTS, Collections.EMPTY_MAP));
    contextRepository.push(job.getId(), context);

    eventPublisher
            .publishEvent(PiperEvent.of(Events.JOB_STATUS, "jobId", job.getId(), "status", job.getStatus()));

    messenger.send(Queues.JOBS, job);

    return job;
}

From source file:TreeNode.java

/**
 * Return an Iterator of the attribute names of this node.  If there are
 * no attributes, an empty Iterator is returned.
 *//*from www.j a  v a 2  s .c o m*/
public Iterator findAttributes() {

    if (attributes == null)
        return (Collections.EMPTY_LIST.iterator());
    else
        return (attributes.keySet().iterator());

}

From source file:com.greenline.hrs.admin.cache.redis.util.RedisInfoParser.java

/**
 * RedisInfoMapT?RedisInfoMapRedis?//from   w  w  w  .j  a  v a2s. c o  m
 *
 * @param redisInfoMap Map
 * @return instanceTypeinfomapnullinfoMap?instancenullRedisServerInfoPO
 */
public static List<RedisKeyspaceInfo> parserToKeySpaceInfo(Map<String, String> redisInfoMap) {
    if (redisInfoMap == null || redisInfoMap.isEmpty()) {
        return Collections.EMPTY_LIST;
    }
    int dbSize = 16;
    String dbSizeStr = redisInfoMap.get(RedisCommonConst.DB_SIZE);
    if (StringUtils.isNumeric(dbSizeStr)) {
        dbSize = Integer.valueOf(dbSizeStr);
    }
    List<RedisKeyspaceInfo> result = new ArrayList<RedisKeyspaceInfo>(dbSize * 2);
    for (int i = 0; i < dbSize; i++) {
        RedisKeyspaceInfo keyspaceInfo = new RedisKeyspaceInfo();
        // TODO createTime??
        keyspaceInfo.setCreateTime(DateTime.now().toDate());
        keyspaceInfo.setDbIndex(i);
        keyspaceInfo.setKeys(0L);
        keyspaceInfo.setExpires(0L);
        String keyspaceStr = redisInfoMap.get("db" + i);
        if (keyspaceStr != null) {
            String[] properties = StringUtils.split(keyspaceStr, KS_PROPERTY_DELIMITER);
            if (properties.length >= KS_PROPERTY_MIN_SIZE) {
                keyspaceInfo.setKeys(Long.valueOf(properties[1]));
                keyspaceInfo.setExpires(Long.valueOf(properties[3]));
                result.add(keyspaceInfo);
            }
        }
    }
    return result;
}

From source file:it.unibas.spicy.model.mapping.rewriting.operators.GenerateExpansionMoreInformativeOrder.java

@SuppressWarnings("unchecked")
private List<ExpansionOrderedPair> isMoreInformative(Expansion fatherExpansion, Expansion expansion,
        MappingTask mappingTask) {//from w w  w . ja  va2 s  .  c  o  m
    if (expansion.equals(fatherExpansion)) {
        throw new IllegalArgumentException("Cannot check subsumption of expansion by itself: " + expansion);
    }
    if (logger.isDebugEnabled())
        logger.debug("***********************************Checking subsumption of : \n" + expansion + "by : \n"
                + fatherExpansion);
    List<List<ExpansionElement>> examinedPermutations = new ArrayList<List<ExpansionElement>>();
    List<ExpansionOrderedPair> result = new ArrayList<ExpansionOrderedPair>();
    List<ExpansionElement> expansionAtoms = expansion.getExpansionElements();
    List<ExpansionElement> fatherExpansionAtoms = fatherExpansion.getExpansionElements();
    if (expansionAtoms.size() > fatherExpansionAtoms.size()) {
        return Collections.EMPTY_LIST;
    }
    GenericCombinationsGenerator<ExpansionElement> combinationsGenerator = new GenericCombinationsGenerator<ExpansionElement>(
            fatherExpansionAtoms, expansionAtoms.size());
    while (combinationsGenerator.hasMoreElements()) {
        List<ExpansionElement> combination = combinationsGenerator.nextElement();
        GenericPermutationsGenerator<ExpansionElement> permutationsGenerator = new GenericPermutationsGenerator<ExpansionElement>(
                combination);
        while (permutationsGenerator.hasMoreElements()) {
            List<ExpansionElement> permutation = permutationsGenerator.nextElement();
            if (!contains(examinedPermutations, permutation)) {
                examinedPermutations.add(permutation);
                ExpansionOrderedPair orderedPair = homomorphismChecker.checkHomomorphism(expansion,
                        expansionAtoms, fatherExpansion, permutation);
                if (orderedPair != null) {
                    //                        if (mappingTask.getConfig().rewriteAllHomomorphisms() ||
                    //                                isProperSubsumption(expansion, fatherExpansion, expansionAtoms, permutation)) {
                    if (homomorphismChecker.checkIfMoreInformative(expansion, fatherExpansion, expansionAtoms,
                            permutation)) {
                        result.add(orderedPair);
                    }
                }
            }
        }
    }
    if (logger.isDebugEnabled())
        logger.debug("***********************************Result: " + result);
    return result;
}