Skip to content

Commit

Permalink
Revert "Removed deprecated classes."
Browse files Browse the repository at this point in the history
This reverts commit dfdacb1.
  • Loading branch information
michael-schnell committed Jan 4, 2020
1 parent e7344d6 commit 8124c45
Show file tree
Hide file tree
Showing 8 changed files with 376 additions and 0 deletions.
57 changes: 57 additions & 0 deletions src/main/java/org/fuin/objects4j/common/GuardedBy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Copyright (C) 2015 Michael Schnell. All rights reserved.
* http://www.fuin.org/
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see http://www.gnu.org/licenses/.
*/
package org.fuin.objects4j.common;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* The field or method to which this annotation is applied can only be accessed when holding a particular lock, which may be a built-in
* (synchronization) lock, or may be an explicit java.util.concurrent.Lock.
*
* The argument determines which lock guards the annotated field or method: this : The string literal "this" means that this field is
* guarded by the class in which it is defined. class-name.this : For inner classes, it may be necessary to disambiguate 'this'; the
* class-name.this designation allows you to specify which 'this' reference is intended itself : For reference fields only; the object to
* which the field refers. field-name : The lock object is referenced by the (instance or static) field specified by field-name.
* class-name.field-name : The lock object is reference by the static field specified by class-name.field-name. method-name() : The lock
* object is returned by calling the named nil-ary method. class-name.class : The Class object for the specified class should be used as the
* lock object.
*
* Copyright (c) 2005 Brian Goetz Released under the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.5)
* Official home: http://www.jcip.net
*
* Original source: http://code.google.com/p/jsr-305/
*
* @deprecated Use <code>javax.annotation.concurrent.GuardedBy</code> from JSR 305 instead (See Maven library
* "com.google.code.findbugs:jsr305").
*/
@Target({ ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.CLASS)
@Deprecated
public @interface GuardedBy {

/**
* Determines which lock guards the annotated field or method.
*
* @return The lock that should be held.
*/
String value();

}
48 changes: 48 additions & 0 deletions src/main/java/org/fuin/objects4j/common/Immutable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright (C) 2015 Michael Schnell. All rights reserved.
* http://www.fuin.org/
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see http://www.gnu.org/licenses/.
*/
package org.fuin.objects4j.common;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* The class to which this annotation is applied is immutable. This means that its state cannot be seen to change by callers. Of necessity
* this means that all public fields are final, and that all public final reference fields refer to other immutable objects, and that
* methods do not publish references to any internal state which is mutable by implementation even if not by design. Immutable objects may
* still have internal mutable state for purposes of performance optimization; some state variables may be lazily computed, so long as they
* are computed from immutable state and that callers cannot tell the difference.
*
* Immutable objects are inherently thread-safe; they may be passed between threads or published without synchronization.
*
* Copyright (c) 2005 Brian Goetz Released under the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.5)
* Official home: http://www.jcip.net
*
* Original source: http://code.google.com/p/jsr-305/
*
* @deprecated Use <code>javax.annotation.concurrent.Immutable</code> from JSR 305 instead (See Maven library
* "com.google.code.findbugs:jsr305").
*/
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
@Deprecated
public @interface Immutable {
}
40 changes: 40 additions & 0 deletions src/main/java/org/fuin/objects4j/common/NeverEmpty.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright (C) 2015 Michael Schnell. All rights reserved.
* http://www.fuin.org/
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see http://www.gnu.org/licenses/.
*/
package org.fuin.objects4j.common;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
* Used to express that a method's return value is never <code>null</code> or empty.
*
* @deprecated Use <code>javax.validation.constraints.NotNull</code> from bean validation instead. It wasn't allowed to use it for a return
* value, but it is now.
*/
// CHECKSTYLE:OFF
@Documented
@Target(value = { METHOD })
@Retention(value = RUNTIME)
@Deprecated
public @interface NeverEmpty {
}
// CHECKSTYLE:ON
40 changes: 40 additions & 0 deletions src/main/java/org/fuin/objects4j/common/NeverNull.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright (C) 2015 Michael Schnell. All rights reserved.
* http://www.fuin.org/
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see http://www.gnu.org/licenses/.
*/
package org.fuin.objects4j.common;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
* Used to express that a method's return value is never <code>null</code>.
*
* @deprecated Use <code>javax.validation.constraints.NotNull</code> from bean validation instead. It wasn't allowed to use it for a return
* value, but it is now.
*/
// CHECKSTYLE:OFF
@Documented
@Target(value = { METHOD })
@Retention(value = RUNTIME)
@Deprecated
public @interface NeverNull {
}
// CHECKSTYLE:ON
57 changes: 57 additions & 0 deletions src/main/java/org/fuin/objects4j/common/NotEmpty.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Copyright (C) 2015 Michael Schnell. All rights reserved.
* http://www.fuin.org/
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see http://www.gnu.org/licenses/.
*/
package org.fuin.objects4j.common;

import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
* Checks if the string, collection, map or array is not null or empty.
*
* @deprecated Use <code>javax.validation.constraints.NotEmpty</code> or <code>javax.validation.constraints.NotBlank</code> from bean
* validation 2.0 instead.
*/
// CHECKSTYLE:OFF
@Documented
@Constraint(validatedBy = {})
@Target(value = { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(value = RUNTIME)
@NotNull
@Size(min = 1)
@Deprecated
public @interface NotEmpty {
String message() default "{org.fuin.objects4j.common.NotEmpty.message}";

Class<?>[] groups() default {};

Class<? extends Payload>[] payload() default {};
}
// CHECKSTYLE:ON
46 changes: 46 additions & 0 deletions src/main/java/org/fuin/objects4j/common/NotThreadSafe.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Copyright (C) 2015 Michael Schnell. All rights reserved.
* http://www.fuin.org/
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see http://www.gnu.org/licenses/.
*/
package org.fuin.objects4j.common;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* The class to which this annotation is applied is not thread-safe. This annotation primarily exists for clarifying the non-thread-safety
* of a class that might otherwise be assumed to be thread-safe, despite the fact that it is a bad idea to assume a class is thread-safe
* without good reason.
*
* Copyright (c) 2005 Brian Goetz Released under the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.5)
* Official home: http://www.jcip.net
*
* Original source: http://code.google.com/p/jsr-305/
*
* @see ThreadSafe
*
* @deprecated Use <code>javax.annotation.concurrent.NotThreadSafe</code> from JSR 305 instead (See Maven library
* "com.google.code.findbugs:jsr305").
*/
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
@Deprecated
public @interface NotThreadSafe {
}
44 changes: 44 additions & 0 deletions src/main/java/org/fuin/objects4j/common/Nullable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright (C) 2015 Michael Schnell. All rights reserved.
* http://www.fuin.org/
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see http://www.gnu.org/licenses/.
*/
package org.fuin.objects4j.common;

import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

/**
* Used to express that a value may be <code>null</code>.
*
* @deprecated Use <code>javax.annotation.Nullable</code> from JSR 305 instead (See Maven library "com.google.code.findbugs:jsr305").
*
*/
// CHECKSTYLE:OFF
@Documented
@Target(value = { METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(value = RUNTIME)
@Deprecated
public @interface Nullable {
}
// CHECKSTYLE:ON
44 changes: 44 additions & 0 deletions src/main/java/org/fuin/objects4j/common/ThreadSafe.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright (C) 2015 Michael Schnell. All rights reserved.
* http://www.fuin.org/
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option) any
* later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see http://www.gnu.org/licenses/.
*/
package org.fuin.objects4j.common;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* The class to which this annotation is applied is thread-safe. This means that no sequences of accesses (reads and writes to public
* fields, calls to public methods) may put the object into an invalid state, regardless of the interleaving of those actions by the
* runtime, and without requiring any additional synchronization or coordination on the part of the caller.
*
* Copyright (c) 2005 Brian Goetz Released under the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.5)
* Official home: http://www.jcip.net
*
* Original source: http://code.google.com/p/jsr-305/
*
* @deprecated Use <code>javax.annotation.concurrent.ThreadSafe</code> from JSR 305 instead (See Maven library
* "com.google.code.findbugs:jsr305").
*/
@Documented
@Target({ ElementType.TYPE, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.CLASS)
@Deprecated
public @interface ThreadSafe {
}

0 comments on commit 8124c45

Please sign in to comment.