use of javax.annotation.Nullable in project immutables by immutables.
the class AccessorAttributesCollector method collect.
void collect() {
collectGeneratedCandidateMethods(getTypeElement());
if (attributes.size() > USEFUL_PARAMETER_COUNT_LIMIT) {
ArrayList<ValueAttribute> list = Lists.newArrayListWithCapacity(USEFUL_PARAMETER_COUNT_LIMIT);
list.addAll(attributes.subList(0, USEFUL_PARAMETER_COUNT_LIMIT));
attributes.clear();
attributes.addAll(list);
protoclass.report().error("Value objects with more than %d attributes (including inherited) are not supported." + " You can decompose '%s' class into a smaller ones", USEFUL_PARAMETER_COUNT_LIMIT, protoclass.name());
}
Instantiator encodingInstantiator = protoclass.encodingInstantiator();
@Nullable InstantiationCreator instantiationCreator = encodingInstantiator.creatorFor((Parameterizable) type.element);
for (ValueAttribute attribute : attributes) {
attribute.initAndValidate(instantiationCreator);
}
if (instantiationCreator != null) {
type.additionalImports(instantiationCreator.imports);
}
type.attributes.addAll(attributes);
type.accessorMapping = accessorMapping;
}
use of javax.annotation.Nullable in project immutables by immutables.
the class Annotations method annotationMatchesTarget.
static boolean annotationMatchesTarget(Element annotationElement, ElementType elementType) {
@Nullable Target target = annotationElement.getAnnotation(Target.class);
if (target != null) {
ElementType[] targetTypes = target.value();
if (targetTypes.length == 0) {
return false;
}
boolean found = false;
for (ElementType t : targetTypes) {
if (t == elementType) {
found = true;
}
}
if (!found) {
return false;
}
}
return true;
}
use of javax.annotation.Nullable in project killbill by killbill.
the class PhasePriceOverrideJson method toPlanPhasePriceOverrides.
public static List<PlanPhasePriceOverride> toPlanPhasePriceOverrides(final List<PhasePriceOverrideJson> priceOverrides, final PlanSpecifier spec, final Currency currency) {
if (priceOverrides == null || priceOverrides.isEmpty()) {
return ImmutableList.<PlanPhasePriceOverride>of();
}
return ImmutableList.copyOf(Iterables.transform(priceOverrides, new Function<PhasePriceOverrideJson, PlanPhasePriceOverride>() {
@Nullable
@Override
public PlanPhasePriceOverride apply(@Nullable final PhasePriceOverrideJson input) {
if (input.getPhaseName() != null) {
return new DefaultPlanPhasePriceOverride(input.getPhaseName(), currency, input.getFixedPrice(), input.getRecurringPrice());
} else {
final PhaseType phaseType = input.getPhaseType() != null ? PhaseType.valueOf(input.getPhaseType()) : null;
final PlanPhaseSpecifier planPhaseSpecifier = spec.getPlanName() != null ? new PlanPhaseSpecifier(spec.getPlanName(), phaseType) : new PlanPhaseSpecifier(spec.getProductName(), spec.getBillingPeriod(), spec.getPriceListName(), phaseType);
final Currency resolvedCurrency = input.getFixedPrice() != null || input.getRecurringPrice() != null ? currency : null;
return new DefaultPlanPhasePriceOverride(planPhaseSpecifier, resolvedCurrency, input.getFixedPrice(), input.getRecurringPrice());
}
}
}));
}
use of javax.annotation.Nullable in project pinot by linkedin.
the class BrokerRequestHandler method findCandidateServers.
/**
* Find the candidate servers to be queried for each set of segments from the routing table.
*
* @param brokerRequest broker request.
* @return map from server to set of segments.
*/
@Nullable
private Map<ServerInstance, SegmentIdSet> findCandidateServers(@Nonnull BrokerRequest brokerRequest) {
String tableName = brokerRequest.getQuerySource().getTableName();
List<String> routingOptions;
Map<String, String> debugOptions = brokerRequest.getDebugOptions();
if (debugOptions == null || !debugOptions.containsKey("routingOptions")) {
routingOptions = Collections.emptyList();
} else {
routingOptions = Splitter.on(",").omitEmptyStrings().trimResults().splitToList(debugOptions.get("routingOptions"));
}
RoutingTableLookupRequest routingTableLookupRequest = new RoutingTableLookupRequest(tableName, routingOptions);
return _routingTable.findServers(routingTableLookupRequest);
}
use of javax.annotation.Nullable in project pinot by linkedin.
the class ZKMetadataProvider method getRealtimeSegmentZKMetadata.
@Nullable
public static RealtimeSegmentZKMetadata getRealtimeSegmentZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableName, String segmentName) {
String realtimeTableName = TableNameBuilder.REALTIME_TABLE_NAME_BUILDER.forTable(tableName);
ZNRecord znRecord = propertyStore.get(constructPropertyStorePathForSegment(realtimeTableName, segmentName), null, AccessOption.PERSISTENT);
// It is possible that the segment metadata has just been deleted due to retention.
if (znRecord == null) {
return null;
}
if (SegmentName.isHighLevelConsumerSegmentName(segmentName)) {
return new RealtimeSegmentZKMetadata(znRecord);
} else {
return new LLCRealtimeSegmentZKMetadata(znRecord);
}
}
Aggregations