Search in sources :

Example 76 with Nullable

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;
}
Also used : InstantiationCreator(org.immutables.value.processor.encode.Instantiator.InstantiationCreator) Instantiator(org.immutables.value.processor.encode.Instantiator) Nullable(javax.annotation.Nullable)

Example 77 with Nullable

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;
}
Also used : Target(java.lang.annotation.Target) ElementType(java.lang.annotation.ElementType) Nullable(javax.annotation.Nullable)

Example 78 with Nullable

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());
            }
        }
    }));
}
Also used : PlanPhaseSpecifier(org.killbill.billing.catalog.api.PlanPhaseSpecifier) Function(com.google.common.base.Function) DefaultPlanPhasePriceOverride(org.killbill.billing.catalog.DefaultPlanPhasePriceOverride) Currency(org.killbill.billing.catalog.api.Currency) PhaseType(org.killbill.billing.catalog.api.PhaseType) Nullable(javax.annotation.Nullable) DefaultPlanPhasePriceOverride(org.killbill.billing.catalog.DefaultPlanPhasePriceOverride) PlanPhasePriceOverride(org.killbill.billing.catalog.api.PlanPhasePriceOverride)

Example 79 with Nullable

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);
}
Also used : RoutingTableLookupRequest(com.linkedin.pinot.routing.RoutingTableLookupRequest) Nullable(javax.annotation.Nullable)

Example 80 with Nullable

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);
    }
}
Also used : RealtimeSegmentZKMetadata(com.linkedin.pinot.common.metadata.segment.RealtimeSegmentZKMetadata) LLCRealtimeSegmentZKMetadata(com.linkedin.pinot.common.metadata.segment.LLCRealtimeSegmentZKMetadata) LLCRealtimeSegmentZKMetadata(com.linkedin.pinot.common.metadata.segment.LLCRealtimeSegmentZKMetadata) ZNRecord(org.apache.helix.ZNRecord) Nullable(javax.annotation.Nullable)

Aggregations

Nullable (javax.annotation.Nullable)735 IOException (java.io.IOException)85 Test (org.junit.Test)59 Map (java.util.Map)58 Function (com.google.common.base.Function)57 List (java.util.List)55 ArrayList (java.util.ArrayList)43 File (java.io.File)42 HashMap (java.util.HashMap)37 ItemStack (net.minecraft.item.ItemStack)36 ImmutableList (com.google.common.collect.ImmutableList)32 SkyKey (com.google.devtools.build.skyframe.SkyKey)28 Nonnull (javax.annotation.Nonnull)28 ImmutableMap (com.google.common.collect.ImmutableMap)27 Predicate (com.google.common.base.Predicate)26 URL (java.net.URL)22 Label (com.google.devtools.build.lib.cmdline.Label)21 HashSet (java.util.HashSet)20 Collectors (java.util.stream.Collectors)15 TypeElement (javax.lang.model.element.TypeElement)15