本文整理汇总了Java中org.apache.commons.lang.mutable.MutableBoolean.booleanValue方法的典型用法代码示例。如果您正苦于以下问题:Java MutableBoolean.booleanValue方法的具体用法?Java MutableBoolean.booleanValue怎么用?Java MutableBoolean.booleanValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.mutable.MutableBoolean
的用法示例。
在下文中一共展示了MutableBoolean.booleanValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyFilters
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
private void applyFilters(ScanTreeNode unfilteredRoot, ScanTreeNode issuesFilteredRoot, ScanTreeNode licenseFilteredRoot, MutableBoolean severitySelected, MutableBoolean licenseSelected) {
severitySelected.setValue(isSeveritySelected(unfilteredRoot));
licenseSelected.setValue(isLicenseSelected(unfilteredRoot));
for (int i = 0; i < unfilteredRoot.getChildCount(); i++) {
ScanTreeNode unfilteredChild = (ScanTreeNode) unfilteredRoot.getChildAt(i);
ScanTreeNode filteredSeverityChild = getFilteredTreeNode(unfilteredChild);
ScanTreeNode filteredLicenseChild = (ScanTreeNode) unfilteredChild.clone();
MutableBoolean childSeveritySelected = new MutableBoolean();
MutableBoolean childLicenseSelected = new MutableBoolean();
applyFilters(unfilteredChild, filteredSeverityChild, filteredLicenseChild, childSeveritySelected, childLicenseSelected);
if (childSeveritySelected.booleanValue()) {
severitySelected.setValue(true);
issuesFilteredRoot.add(filteredSeverityChild);
}
if (childLicenseSelected.booleanValue()) {
licenseSelected.setValue(true);
licenseFilteredRoot.add(filteredLicenseChild);
}
}
}
示例2: addToken
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
private void addToken(TokenGroup group, int start, int end, String charString, MutableBoolean isNewLine,
Token lastToken) {
Token token = new Token(start, end, charString);
if (isNewLine.booleanValue()) {
group.addNewLine(start);
isNewLine.setValue(false);
}
token.setPreceedBySpace(start - lastToken.getEnd() > 0);
int spaces = 0;
if (lastToken != null && lastToken.getEnd() != 0) {
int endLast = lastToken.getEnd();
spaces = lastToken.getSpaceOffset();
if (start == endLast) {
spaces++;
} else {
spaces -= Math.max(0, start - endLast - 1);
}
}
token.setSpaceOffset(spaces);
// Normalization
String n;
if (charString.length() == 1) {
int c = charString.charAt(0);
n = normalizedChars.get(c);
} else {
n = normalizedStrings.get(charString);
}
if (n != null) {
token.setNormForm(n);
}
lastToken.updateByToken(token);
group.addToken(token);
}
示例3: processAuthorizationContainerDelta
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
private <C extends Containerable> boolean processAuthorizationContainerDelta(ContainerDelta<C> cdelta, final Collection<ItemPath> allowedItems) {
final MutableBoolean itemDecision = new MutableBoolean(true);
cdelta.foreach(cval -> {
if (!isContainerAllowed(cval, allowedItems)) {
itemDecision.setValue(false);
}
});
return itemDecision.booleanValue();
}
示例4: checkProhibitedValues
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
private <O extends ObjectType, R extends ObjectType> boolean checkProhibitedValues(String newPassword, ProhibitedValuesType prohibitedValuesType, AbstractValuePolicyOriginResolver<O> originResolver,
Consumer<ProhibitedValueItemType> failAction, String shortDesc, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException {
if (prohibitedValuesType == null || originResolver == null) {
return true;
}
MutableBoolean isAcceptable = new MutableBoolean(true);
for (ProhibitedValueItemType prohibitedItemType: prohibitedValuesType.getItem()) {
ItemPathType itemPathType = prohibitedItemType.getPath();
if (itemPathType == null) {
throw new SchemaException("No item path defined in prohibited item in "+shortDesc);
}
ItemPath itemPath = itemPathType.getItemPath();
ResultHandler<R> handler = (object, objectResult) -> {
PrismProperty<Object> objectProperty = object.findProperty(itemPath);
if (objectProperty == null) {
return true;
}
if (isMatching(newPassword, objectProperty)) {
if (failAction != null) {
failAction.accept(prohibitedItemType);
}
isAcceptable.setValue(false);
return false;
}
return true;
};
originResolver.resolve(handler, prohibitedItemType, shortDesc, task, result);
}
return isAcceptable.booleanValue();
}
示例5: registerTouchedListener
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
public boolean registerTouchedListener(final IModel<? extends TouchedListener> listener, String... wicketIdPrefixes) {
final MutableBoolean changed = new MutableBoolean(false);
doWithMatchingModels(new ModelCallback() {
@Override
public boolean doWithModel(TouchedListenerModelWrapper<?> model) {
if (model.registerTouchedListener(listener)) {
changed.setValue(true);
}
return true;
}
}, wicketIdPrefixes);
return changed.booleanValue();
}
示例6: unregisterTouchedListener
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
public boolean unregisterTouchedListener(final IModel<? extends TouchedListener> listener,
String... wicketIdPrefixes) {
final MutableBoolean changed = new MutableBoolean(false);
doWithMatchingModels(new ModelCallback() {
@Override
public boolean doWithModel(TouchedListenerModelWrapper<?> model) {
if (model.unregisterTouchedListener(listener)) {
changed.setValue(true);
}
return true;
}
}, wicketIdPrefixes);
return changed.booleanValue();
}
示例7: getUserConfirmation
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
@Override
public boolean getUserConfirmation(final String title, final String message) throws QTasteException {
final MutableBoolean confirmed = new MutableBoolean();
try {
SwingUtilities.invokeAndWait(() -> {
int result = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION);
confirmed.setValue(result == JOptionPane.YES_OPTION);
});
} catch (Exception e) {
throw new QTasteException("Error while showing user confirmation dialog", e);
}
return confirmed.booleanValue();
}
示例8: test
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
@Test
public void test() throws IOException, InterruptedException {
final HRegionServer rs = testUtil.getRSForFirstRegionInTable(tableName);
final HRegion region = (HRegion) rs.getOnlineRegions(tableName).get(0);
HRegion spiedRegion = spy(region);
final MutableBoolean flushed = new MutableBoolean(false);
final MutableBoolean reported = new MutableBoolean(false);
doAnswer(new Answer<FlushResult>() {
@Override
public FlushResult answer(InvocationOnMock invocation) throws Throwable {
synchronized (flushed) {
flushed.setValue(true);
flushed.notifyAll();
}
synchronized (reported) {
while (!reported.booleanValue()) {
reported.wait();
}
}
rs.getWAL(region.getRegionInfo()).abortCacheFlush(
region.getRegionInfo().getEncodedNameAsBytes());
throw new DroppedSnapshotException("testcase");
}
}).when(spiedRegion).internalFlushCacheAndCommit(Matchers.<WAL> any(),
Matchers.<MonitoredTask> any(), Matchers.<PrepareFlushResult> any(),
Matchers.<Collection<Store>> any());
// Find region key; don't pick up key for hbase:meta by mistake.
String key = null;
for (Map.Entry<String, Region> entry: rs.onlineRegions.entrySet()) {
if (entry.getValue().getRegionInfo().getTable().equals(this.tableName)) {
key = entry.getKey();
break;
}
}
rs.onlineRegions.put(key, spiedRegion);
Connection conn = testUtil.getConnection();
try (Table table = conn.getTable(tableName)) {
table.put(new Put(Bytes.toBytes("row0")).addColumn(family, qualifier, Bytes.toBytes("val0")));
}
long oldestSeqIdOfStore = region.getOldestSeqIdOfStore(family);
LOG.info("CHANGE OLDEST " + oldestSeqIdOfStore);
assertTrue(oldestSeqIdOfStore > HConstants.NO_SEQNUM);
rs.cacheFlusher.requestFlush(spiedRegion, false);
synchronized (flushed) {
while (!flushed.booleanValue()) {
flushed.wait();
}
}
try (Table table = conn.getTable(tableName)) {
table.put(new Put(Bytes.toBytes("row1")).addColumn(family, qualifier, Bytes.toBytes("val1")));
}
long now = EnvironmentEdgeManager.currentTime();
rs.tryRegionServerReport(now - 500, now);
synchronized (reported) {
reported.setValue(true);
reported.notifyAll();
}
while (testUtil.getRSForFirstRegionInTable(tableName) == rs) {
Thread.sleep(100);
}
try (Table table = conn.getTable(tableName)) {
Result result = table.get(new Get(Bytes.toBytes("row0")));
assertArrayEquals(Bytes.toBytes("val0"), result.getValue(family, qualifier));
}
}
示例9: doRepay
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
private Transfer doRepay(final RepayLoanDTO params) {
BigDecimal amount = params.getAmount();
// Check if the amount is valid
if (amount.compareTo(paymentService.getMinimumPayment()) < 0) {
throw new ValidationException("amount", "loan.amount", new InvalidError());
}
// Get the loan payment to repay
Calendar date = params.getDate();
if (date == null) {
date = Calendar.getInstance();
params.setDate(date);
}
final LoanRepaymentAmountsDTO amountsDTO = getLoanPaymentAmount(params);
final LoanPayment payment = amountsDTO.getLoanPayment();
if (payment == null) {
throw new UnexpectedEntityException();
}
// Validate the amount
final BigDecimal remainingAmount = amountsDTO.getRemainingAmountAtDate();
final BigDecimal diff = remainingAmount.subtract(amount);
final MutableBoolean totallyRepaid = new MutableBoolean();
// If the amount is on an acceptable delta, set the transfer value = parcel value
if (diff.abs().floatValue() < PRECISION_DELTA) {
amount = remainingAmount;
totallyRepaid.setValue(true);
} else if (diff.compareTo(BigDecimal.ZERO) < 0 || !params.getLoan().getTransfer().getType().getLoan().getType().allowsPartialRepayments()) {
throw new ValidationException("amount", "loan.amount", new InvalidError());
}
final LocalSettings localSettings = settingsService.getLocalSettings();
Loan loan = fetchService.fetch(params.getLoan(), Loan.Relationships.PAYMENTS, RelationshipHelper.nested(Loan.Relationships.TRANSFER, Payment.Relationships.TO, MemberAccount.Relationships.MEMBER), Loan.Relationships.TO_MEMBERS);
// Build the transfers for repayment
final List<TransferDTO> transfers = handlersByType.get(loan.getParameters().getType()).buildTransfersForRepayment(params, amountsDTO);
Transfer root = null;
BigDecimal totalAmount = BigDecimal.ZERO;
for (final TransferDTO dto : transfers) {
if (dto.getAmount().floatValue() < PRECISION_DELTA) {
// If the root amount is zero, it means that the parent transfer should be the last transfer for this loan payment
final TransferQuery tq = new TransferQuery();
tq.setLoanPayment(payment);
tq.setReverseOrder(true);
tq.setUniqueResult();
final List<Transfer> paymentTransfers = paymentService.search(tq);
if (paymentTransfers.isEmpty()) {
throw new IllegalStateException("The root transfer has amount 0 and there is no other transfers for this payment");
}
root = paymentTransfers.iterator().next();
} else {
totalAmount = totalAmount.add(dto.getAmount());
dto.setParent(root);
dto.setLoanPayment(payment);
final Transfer transfer = (Transfer) paymentService.insertWithoutNotification(dto);
if (root == null) {
// The first will be the root. All others are it's children
root = transfer;
}
}
}
// Update the loan payment
final BigDecimal totalRepaid = localSettings.round(payment.getRepaidAmount().add(totalAmount));
payment.setRepaidAmount(totalRepaid);
if (totallyRepaid.booleanValue()) {
// Mark the payment as repaid, if is the case
payment.setStatus(LoanPayment.Status.REPAID);
payment.setRepaymentDate(params.getDate());
}
payment.setTransfers(null); // Avoid 2 representations of the transfers collection. It's inverse="true", no problem setting null
loanPaymentDao.update(payment);
// Return the generated root transfer
return root;
}
示例10: cancelScheduledPaymentsAndNotify
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
@Override
public void cancelScheduledPaymentsAndNotify(final Member member, final Collection<MemberAccountType> accountTypes) {
List<ScheduledPayment> scheduledPayments = scheduledPaymentDao.getUnrelatedPendingPayments(member, accountTypes);
final Set<Member> membersToNotify = new HashSet<Member>();
final Set<MemberAccountType> removedAccounts = new HashSet<MemberAccountType>();
// this flag is true if the member was not removed and at least on of the incoming payment should notify the receiver (in this case the
// member)
// or is from an invoice or there is at least one outgoing payment (the member is the payer)
final MutableBoolean notifyMember = new MutableBoolean(false);
for (ScheduledPayment scheduledPayment : scheduledPayments) {
cancel(scheduledPayment);
boolean incoming = member.equals(scheduledPayment.getToOwner());
if (incoming) { // member is the receiver then notify the payer
if (scheduledPayment.getFromOwner() instanceof Member) { // there is not notification for incoming system payments
Member payer = (Member) scheduledPayment.getFromOwner();
membersToNotify.add(payer);
if (!member.getGroup().isRemoved() && !notifyMember.booleanValue()) {
notifyMember.setValue(scheduledPayment.isShowToReceiver() || isFromInvoice(scheduledPayment));
}
removedAccounts.add((MemberAccountType) scheduledPayment.getTo().getType());
}
} else { // outgoing (member is the payer)
if (scheduledPayment.getToOwner() instanceof Member) { // there is not notification for outgoing system payments
if (scheduledPayment.isShowToReceiver() || isFromInvoice(scheduledPayment)) {
Member receiver = (Member) scheduledPayment.getToOwner();
membersToNotify.add(receiver);
}
removedAccounts.add((MemberAccountType) scheduledPayment.getFrom().getType());
}
if (!member.getGroup().isRemoved()) {
notifyMember.setValue(true);
}
}
}
if (!scheduledPayments.isEmpty()) {
CurrentTransactionData.addTransactionCommitListener(new TransactionCommitListener() {
@Override
public void onTransactionCommit() {
transactionHelper.runInCurrentThread(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(final TransactionStatus status) {
memberNotificationHandler.scheduledPaymentsCancelledNotification(member, notifyMember.booleanValue(), membersToNotify, removedAccounts);
}
});
}
});
}
}
示例11: matchTaxEntNames
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
@Override
public void matchTaxEntNames(Inventory inventory, boolean createNew, boolean doMatch, InventoryList inventories) throws FloraOnException {
INodeWorker nwd = driver.getNodeWorkerDriver();
MutableBoolean ask = new MutableBoolean(false);
for(OBSERVED_IN oi : inventory.getUnmatchedOccurrences()) {
TaxEnt te, te1;
List<TaxEnt> matched;
Log.info("Verbose name: "+ oi.getVerbTaxon());
if(oi.getVerbTaxon() == null) continue;
if(oi.getVerbTaxon().trim().equals("")) {
Log.info(" Empty name, clearing");
// if(inventories != null) inventories.addNoMatch(oi);
oi.setTaxEntMatch("");
continue;
}
try {
te = TaxEnt.parse(oi.getVerbTaxon());
} catch (FloraOnException e) { // could not even parse the name
if(inventories != null)
// inventories.addQuestion(oi.getVerbTaxon(), oi.getUuid(), null);
inventories.addParseError(oi.getVerbTaxon());
Log.warn(e.getMessage());
oi.setTaxEntMatch("");
continue;
}
Log.info(" Parsed name: "+ te.getFullName(false));
matched = nwd.getTaxEnt(te, ask);
switch(matched.size()) {
case 0:
if (createNew) {
te1 = nwd.createTaxEntFromTaxEnt(te);
Log.warn(" No match, created new taxon");
if(inventories != null) inventories.addNoMatch(oi);
oi.setTaxEntMatch(te1.getID());
} else {
Log.warn(" No match, do you want to add new taxon?");
if(inventories != null)
inventories.addQuestion(oi.getVerbTaxon(), oi.getUuid(), null);
//inventories.addNoMatch(oi);
oi.setTaxEntMatch("");
}
break;
default:
if(!ask.booleanValue()) {
Log.info(" Matched name: " + matched.get(0).getFullName(false), " -- ", matched.get(0).getID());
oi.setTaxEntMatch(matched.get(0).getID());
if(doMatch && inventories != null) {
Map<String, TaxonomicChange> tmp1 = new HashMap<>();
tmp1.put(oi.getVerbTaxon(), new TaxonomicChange(matched.get(0).getID(), oi.getUuid().toString(), null));
replaceTaxEntMatch(tmp1);
inventories.getVerboseWarnings().add("Automatically matched " + oi.getVerbTaxon() + " to " + matched.get(0).getID());
//inventories.addQuestion(oi.getVerbTaxon(), oi.getUuid(), matched.get(0));
}
} else {
if(matched.size() == 0 && inventories != null)
inventories.addQuestion(oi.getVerbTaxon(), oi.getUuid(), null);
else {
for (TaxEnt tmp : matched) {
if (inventories != null)
inventories.addQuestion(oi.getVerbTaxon(), oi.getUuid(), tmp);
}
}
oi.setTaxEntMatch("");
}
break;
}
}
}
示例12: handleResponse
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
@Override
public ProtocolResponse handleResponse(HttpResponse response)
throws IOException {
StatusLine statusLine = response.getStatusLine();
int status = statusLine.getStatusCode();
StringBuilder verbatim = new StringBuilder();
if (storeHTTPHeaders) {
verbatim.append(statusLine.toString()).append("\r\n");
}
Metadata metadata = new Metadata();
HeaderIterator iter = response.headerIterator();
while (iter.hasNext()) {
Header header = iter.nextHeader();
if (storeHTTPHeaders) {
verbatim.append(header.toString()).append("\r\n");
}
metadata.addValue(header.getName().toLowerCase(Locale.ROOT),
header.getValue());
}
MutableBoolean trimmed = new MutableBoolean();
byte[] bytes = new byte[] {};
if (!Status.REDIRECTION.equals(Status.fromHTTPCode(status))) {
bytes = HttpProtocol.toByteArray(response.getEntity(), maxContent,
trimmed);
if (trimmed.booleanValue()) {
metadata.setValue("http.trimmed", "true");
LOG.warn("HTTP content trimmed to {}", bytes.length);
}
}
if (storeHTTPHeaders) {
verbatim.append("\r\n");
metadata.setValue("_response.headers_", verbatim.toString());
}
return new ProtocolResponse(bytes, status, metadata);
}
示例13: getProtocolOutput
import org.apache.commons.lang.mutable.MutableBoolean; //导入方法依赖的package包/类
@Override
public ProtocolResponse getProtocolOutput(String url,
final Metadata metadata) throws Exception {
Builder rb = new Request.Builder().url(url);
customRequestHeaders.forEach((k) -> {
rb.header(k[0], k[1]);
});
if (metadata != null) {
String lastModified = metadata.getFirstValue("last-modified");
if (StringUtils.isNotBlank(lastModified)) {
rb.header("If-Modified-Since", lastModified);
}
String ifNoneMatch = metadata.getFirstValue("etag");
if (StringUtils.isNotBlank(ifNoneMatch)) {
rb.header("If-None-Match", ifNoneMatch);
}
}
Request request = rb.build();
Call call = client.newCall(request);
try (Response response = call.execute()) {
byte[] bytes = new byte[] {};
Metadata responsemetadata = new Metadata();
Headers headers = response.headers();
for (int i = 0, size = headers.size(); i < size; i++) {
String key = headers.name(i);
String value = headers.value(i);
if (key.equalsIgnoreCase(VERBATIM_REQUEST_KEY)
|| key.equalsIgnoreCase(VERBATIM_RESPONSE_KEY)) {
value = new String(Base64.getDecoder().decode(value));
}
responsemetadata.addValue(key.toLowerCase(Locale.ROOT), value);
}
MutableBoolean trimmed = new MutableBoolean();
bytes = toByteArray(response.body(), trimmed);
if (trimmed.booleanValue()) {
if (!call.isCanceled()) {
call.cancel();
}
responsemetadata.setValue("http.trimmed", "true");
LOG.warn("HTTP content trimmed to {}", bytes.length);
}
return new ProtocolResponse(bytes, response.code(),
responsemetadata);
}
}