/** * Returns the value of this time in milliseconds. */ @Pure @Override @Default(name = "CurrentTime", value = "System.currentTimeMillis()") public abstract long getValue();
/** * Returns the fair reentrant lock which is used to implement this non-reentrant lock. * This method intentionally allows to acquire the lock reentrantly for special cases. */ @Pure @Derive("new ReentrantLock(true)") public abstract @Nonnull ReentrantLock getReentrantLock();
@Pure @Recover @TODO(task = "Support the conversion of freezable collections. (This method is nonsense, of course.)", date = "2016-11-09", author = Author.KASPAR_ETTER) public static @Nonnull ReadOnlyList with(boolean frozen) { return FreezableLinkedList.withNoElements(); }
addStatement("this." + field.getName() + " = " + field.getAnnotation(Normalize.class).value()); } else if (field.hasSetter() && field.getSetter().hasAnnotation(Normalize.class)) { addStatement("this." + field.getName() + " = " + field.getSetter().getAnnotation(Normalize.class).value()); } else { addStatement("this." + field.getName() + " = " + field.getName()); addStatement("this." + field.getName() + " = " + field.getAnnotation(Derive.class).value());
return defaultAnnotation.value(); } else { if (getType().getKind().isPrimitive()) {
@Pure @Override public int compare(@Nonnull FieldInformation fieldInformation1, @Nonnull FieldInformation fieldInformation2) { if (!fieldInformation1.hasAnnotation(OrderOfAssignment.class) && !fieldInformation2.hasAnnotation(OrderOfAssignment.class)) { return 0; } else if (!fieldInformation1.hasAnnotation(OrderOfAssignment.class)) { return 1; } else if (!fieldInformation2.hasAnnotation(OrderOfAssignment.class)) { return -1; } else { final @Nonnull OrderOfAssignment orderOfAssignment1 = fieldInformation1.getAnnotation(OrderOfAssignment.class); final @Nonnull OrderOfAssignment orderOfAssignment2 = fieldInformation2.getAnnotation(OrderOfAssignment.class); return orderOfAssignment1.value() - orderOfAssignment2.value(); } }
@Pure @Override public void checkUsage(@Nonnull Element element, @Nonnull AnnotationMirror annotationMirror, @NonCaptured @Modified @Nonnull ErrorLogger errorLogger) { final @Nonnull TypeElement surroundingType = ProcessingUtility.getSurroundingType(element); if (element.getKind() == ElementKind.METHOD) { final @Nonnull ExecutableElement method = (ExecutableElement) element; final @Nonnull Types typeUtils = StaticProcessingEnvironment.getTypeUtils(); if (!element.getModifiers().contains(Modifier.STATIC) || !typeUtils.isSubtype(method.getReturnType(), typeUtils.erasure(surroundingType.asType()))) { errorLogger.log("The annotation $ may only be used on static methods whose return type is a subtype of the surrounding type.", SourcePosition.of(element, annotationMirror), getAnnotationNameWithLeadingAt()); } } else if (element.getKind() == ElementKind.CONSTRUCTOR) { if (ProcessingUtility.getConstructors(surroundingType).isSingle()) { errorLogger.log("The annotation $ may only be used on constructors if there are also other constructors in the same class.", SourcePosition.of(element, annotationMirror), getAnnotationNameWithLeadingAt()); } } else { errorLogger.log("The annotation $ may only be used on methods and constructors.", SourcePosition.of(element, annotationMirror), getAnnotationNameWithLeadingAt()); } for (@Nonnull ExecutableElement executableElement : ProcessingUtility.getConstructors(surroundingType).combine(ProcessingUtility.getMethods(surroundingType))) { if (ProcessingUtility.hasAnnotation(executableElement, Recover.class) && !executableElement.equals(element)) { errorLogger.log("The annotation $ may only be used on at most one executable in the same type.", SourcePosition.of(element, annotationMirror), getAnnotationNameWithLeadingAt()); } } }
final @Nonnull String statement; if (normalize != null) { statement = ("this." + field.getName() + " = " + normalize.value()); } else { statement = ("this." + field.getName() + " = " + parameter.getSimpleName());
@Impure private void addDecodingStatement(@Nonnull FieldInformation field) { final @Nonnull TypeMirror type = field.getType(); final @Nonnull String provided = field.hasAnnotation(Provide.class) ? field.getAnnotation(Provide.class).value() : "null";
/** * Returns the validator which validates the values. */ @Pure @Default("object -> true") public @Nonnull Predicate<? super V> getValueValidator();
@Nullable String defaultValue = null; if (hasAnnotation(Default.class)) { defaultValue = getAnnotation(Default.class).value(); } else { if (getMatchingField() != null && getMatchingField().hasDefaultValue()) {
/** * Returns the validator which validates the keys. */ @Pure @Default("object -> true") public @Nonnull Predicate<? super K> getKeyValidator();
@Pure @Override @Default("net.digitalid.utility.collections.set.FreezableLinkedHashSetBuilder.build()") protected abstract @Nonnull @NonFrozen FreezableSet<@Nonnull @Valid VALUE> getSet();
@Pure @Override @Default("net.digitalid.utility.collections.map.FreezableLinkedHashMapBuilder.build()") protected abstract @Nonnull @NonFrozen FreezableMap<@Nonnull @Valid("key") KEY, @Nonnull @Valid VALUE> getMap();
@Recover protected ConcurrentHashSet(@NonNegative @Default("16") int initialCapacity, @Positive @Default("0.75f") float loadFactor, @Positive @Default("1") int concurrencyLevel) { this.map = ConcurrentHashMapBuilder.<E, Boolean>withInitialCapacity(initialCapacity).withLoadFactor(loadFactor).withConcurrencyLevel(concurrencyLevel).build(); this.set = map.keySet(); }