Fixed javadoc warnings
This commit is contained in:
parent
708b415460
commit
818d73ac2e
11 changed files with 63 additions and 35 deletions
|
|
@ -45,7 +45,7 @@ import java.util.logging.Logger;
|
|||
/**
|
||||
* The class that extends this will be able to save its state to a database.
|
||||
* Fields that are transient will be ignored, and fields that extend
|
||||
* DBBean will be replaced with the an id which corresponds to the field
|
||||
* DBBean will be replaced with the id which corresponds to the field
|
||||
* of that object.
|
||||
*
|
||||
* <p>
|
||||
|
|
@ -62,6 +62,7 @@ import java.util.logging.Logger;
|
|||
* <li>DBBean (A Integer reference to another Bean in another table)</li>
|
||||
* <li>List<DBBean> (A reference table is used to associate Beans into the list)</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Ziver
|
||||
*/
|
||||
public abstract class DBBean {
|
||||
|
|
@ -77,7 +78,7 @@ public abstract class DBBean {
|
|||
String value();
|
||||
/** Change the id column name of the bean, default column name is "id", SQL rules apply should not contain any strange characters or spaces **/
|
||||
String idColumn() default "id";
|
||||
/** Sets if the fields in the super classes is also part of the bean **/
|
||||
/** Indicates if the fields in the super classes should also be part of the bean **/
|
||||
boolean superBean() default false;
|
||||
}
|
||||
|
||||
|
|
@ -87,7 +88,7 @@ public abstract class DBBean {
|
|||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface DBColumn {
|
||||
/** This is the name of the column in the database for the specified field. SQL rules apply, should not contain any strange characters or spaces **/
|
||||
/** The name of the column in the database for the specified field. SQL rules apply, should not contain any strange characters or spaces **/
|
||||
String value();
|
||||
}
|
||||
|
||||
|
|
@ -144,8 +145,9 @@ public abstract class DBBean {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void save(DBConnection db, boolean recursive) throws SQLException{
|
||||
if (saveLock.isHeldByCurrentThread()) // If the current thread already has a lock then this
|
||||
return; // is a recursive call and we do not need to do anything
|
||||
else if (saveLock.tryLock()) {
|
||||
return; // is a recursive call, and we do not need to do anything
|
||||
|
||||
if (saveLock.tryLock()) {
|
||||
Class<? extends DBBean> c = this.getClass();
|
||||
DBBeanConfig config = DBBeanConfig.getBeanConfig(c);
|
||||
try {
|
||||
|
|
@ -164,13 +166,13 @@ public abstract class DBBean {
|
|||
sqlValues.append(", ");
|
||||
sqlValues.append("?");
|
||||
}
|
||||
if (config.getFields().size() > 0) { // is there any fields?
|
||||
if (config.getFields().size() > 0) { // are there any fields in the class?
|
||||
query.append(" (").append(sqlCols).append(")");
|
||||
query.append(" VALUES(").append(sqlValues).append(")");
|
||||
} else
|
||||
query.append(" DEFAULT VALUES");
|
||||
}
|
||||
else if (config.getFields().size() > 0) { // Is there any fields to update?
|
||||
else if (config.getFields().size() > 0) { // are there any fields to update?
|
||||
query.append("UPDATE ").append(config.getTableName());
|
||||
StringBuilder sqlSets = new StringBuilder();
|
||||
for (DBBeanFieldConfig field : config.getFields()) {
|
||||
|
|
@ -191,8 +193,8 @@ public abstract class DBBean {
|
|||
// Put in the variables in the SQL
|
||||
int index = 1;
|
||||
for (DBBeanFieldConfig field : config.getFields()) {
|
||||
// Another DBBean class
|
||||
if (DBBean.class.isAssignableFrom(field.getType())) {
|
||||
// Another DBBean class
|
||||
DBBean subObj = (DBBean) field.getValue(this);
|
||||
if (subObj != null) {
|
||||
if (recursive || subObj.getId() == null)
|
||||
|
|
@ -200,14 +202,13 @@ public abstract class DBBean {
|
|||
stmt.setObject(index, subObj.getId());
|
||||
} else
|
||||
stmt.setObject(index, null);
|
||||
index++;
|
||||
}
|
||||
// Normal field
|
||||
else {
|
||||
} else {
|
||||
// Normal field
|
||||
Object value = field.getValue(this);
|
||||
stmt.setObject(index, value);
|
||||
index++;
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
if (this.id != null)
|
||||
stmt.setObject(index, this.id);
|
||||
|
|
@ -290,6 +291,7 @@ public abstract class DBBean {
|
|||
* @param recursive if all sub beans should be deleted also
|
||||
* @throws SQLException if there is any issue with the SQL query
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void delete(DBConnection db, boolean recursive) throws SQLException{
|
||||
Class<? extends DBBean> c = this.getClass();
|
||||
DBBeanConfig config = DBBeanConfig.getBeanConfig(c);
|
||||
|
|
@ -367,8 +369,7 @@ public abstract class DBBean {
|
|||
PreparedStatement stmt = db.getPreparedStatement(sql);
|
||||
stmt.setObject(1, id);
|
||||
// Run query
|
||||
T obj = DBConnection.exec(stmt, DBBeanSQLResultHandler.create(c, db));
|
||||
return obj;
|
||||
return DBConnection.exec(stmt, DBBeanSQLResultHandler.create(c, db));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -400,8 +401,8 @@ public abstract class DBBean {
|
|||
query.delete(query.length()-2, query.length());
|
||||
query.append(")");
|
||||
|
||||
logger.finest("Create Bean(" + c.getName() + ") query: " + db.toString());
|
||||
PreparedStatement stmt = db.getPreparedStatement(db.toString());
|
||||
logger.finest("Create Bean(" + c.getName() + ") query: " + query);
|
||||
PreparedStatement stmt = db.getPreparedStatement(query.toString());
|
||||
|
||||
// Execute the SQL
|
||||
DBConnection.exec(stmt);
|
||||
|
|
@ -432,7 +433,7 @@ public abstract class DBBean {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the bean id or null if the bean has not bean saved yet
|
||||
* @return the bean id or null if the bean has not been saved yet
|
||||
*/
|
||||
public final Long getId() {
|
||||
return id;
|
||||
|
|
|
|||
|
|
@ -81,6 +81,8 @@ public class FileSearcher implements Iterable<FileSearcher.FileSearchItem>{
|
|||
|
||||
/**
|
||||
* Defines if the search should go into sub-folders
|
||||
*
|
||||
* @param recursive true if search should be recursive into subfolders
|
||||
*/
|
||||
public void setRecursive(boolean recursive) {
|
||||
this.recursive = recursive;
|
||||
|
|
@ -95,19 +97,25 @@ public class FileSearcher implements Iterable<FileSearcher.FileSearchItem>{
|
|||
//}
|
||||
|
||||
/**
|
||||
* Sets if the searcher should match to files.
|
||||
* Sets if the search should include files.
|
||||
*
|
||||
* @param searchFiles true if files should be included in the search results.
|
||||
*/
|
||||
public void searchFiles(boolean searchFiles) {
|
||||
this.searchFiles = searchFiles;
|
||||
}
|
||||
/**
|
||||
* Sets if the searcher should match to folders.
|
||||
* Sets if the search should include folders.
|
||||
*
|
||||
* @param searchFolders true if folders should be included in search.
|
||||
*/
|
||||
public void searchFolders(boolean searchFolders) {
|
||||
this.searchFolders = searchFolders;
|
||||
}
|
||||
/**
|
||||
* Sets if the searcher should go into compressed files.
|
||||
* Sets if the searcher should traverse into compressed files. Currently, only zip files are supported.
|
||||
*
|
||||
* @param searchCompressedFiles true if compressed files should be traversed.
|
||||
*/
|
||||
public void searchCompressedFiles(boolean searchCompressedFiles) {
|
||||
this.searchCompressedFiles = searchCompressedFiles;
|
||||
|
|
@ -248,9 +256,12 @@ public class FileSearcher implements Iterable<FileSearcher.FileSearchItem>{
|
|||
boolean isFile();
|
||||
boolean isDirectory();
|
||||
|
||||
/** @return an InputStream if this is a file otherwise null **/
|
||||
/**
|
||||
* @return an InputStream if this is a file otherwise null
|
||||
* @throws IOException if there is any IO issue with retrieving the stream object.
|
||||
*/
|
||||
InputStream getInputStream() throws IOException;
|
||||
/** @return an String array with all files if this is a folder otherwise null **/
|
||||
/** @return a String array with all files if this is a folder otherwise null **/
|
||||
String[] listFiles();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public interface AcmeChallengeFactory {
|
|||
/**
|
||||
* Create a new Challenge object and do any needed actions for the challenge to proceed.
|
||||
*
|
||||
* @param authorization
|
||||
* @param authorization the authorization object t o use for the challenge.
|
||||
* @return a Challenge object that will be used to authorize a domain.
|
||||
* @throws AcmeException in case of any issues
|
||||
*/
|
||||
|
|
@ -17,6 +17,8 @@ public interface AcmeChallengeFactory {
|
|||
|
||||
/**
|
||||
* Do any needed cleanup after challenge has completed successfully or failed.
|
||||
*
|
||||
* @param challenge the Challenge object that was used for the challenge.
|
||||
*/
|
||||
default void postChallengeAction(Challenge challenge) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,12 @@ public class AcmeClient {
|
|||
/**
|
||||
* Create a new instance of the ACME Client and authenticates the user account towards
|
||||
* the AMCE service, if no account exists then a new one will be created.
|
||||
*
|
||||
* @param dataStore the AcmeDataStore that should be used to store persistent data.
|
||||
* @param challengeFactory the challenge type to be used.
|
||||
* @param acmeServerUrl the URL to the ACME server.
|
||||
*
|
||||
* @throws AcmeException in case there is an issue retrieving the ACME account information.
|
||||
*/
|
||||
public AcmeClient(AcmeDataStore dataStore, AcmeChallengeFactory challengeFactory, String acmeServerUrl) throws AcmeException {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
|
|
@ -88,7 +94,7 @@ public class AcmeClient {
|
|||
* This method will prepare the request for the ACME service. Any manual action must be taken after this
|
||||
* method has been called and before the {@link #requestCertificate()} method is called.
|
||||
*
|
||||
* @throws AcmeException
|
||||
* @throws AcmeException if there is a issue preparing the ACME challenge before doing the request to the server.
|
||||
*/
|
||||
public void prepareRequest() throws AcmeException {
|
||||
order = acmeAccount.newOrder().domains(domains).create(); // Order the certificate
|
||||
|
|
@ -110,6 +116,9 @@ public class AcmeClient {
|
|||
* the preparation and the actual request.
|
||||
*
|
||||
* @return a certificate for the given domains.
|
||||
*
|
||||
* @throws IOException if there is a network issue connecting to the ACME server.
|
||||
* @throws AcmeException if there is an issue with the executing the ACME challenge towards the ACME server.
|
||||
*/
|
||||
public X509Certificate requestCertificate() throws IOException, AcmeException {
|
||||
if (order == null)
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ public class HttpURL {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param query the string representing the key value pair separated by & that will be parsed and set as the parameters of the URL
|
||||
* @param query the string representing the key value pair separated by & that will be parsed and set as the parameters of the URL
|
||||
* @return a reference to this object so that set methods can be chained.
|
||||
*/
|
||||
protected HttpURL setParameters(String query) {
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ public class FFmpegInput {
|
|||
|
||||
/**
|
||||
* Add additional args that may not be supported by the API, these values will be inserted to the command line as is.
|
||||
*
|
||||
* @param args a list of additional commands
|
||||
*/
|
||||
public void addAdditionalArg(String... args) {
|
||||
additionalArgs.addAll(Arrays.asList(args));
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@ public class FFmpegOutput {
|
|||
|
||||
/**
|
||||
* Add additional args that may not be supported by the API, these values will be inserted to the command line as is.
|
||||
*
|
||||
* @param args a list of FFmpeg arguments
|
||||
*/
|
||||
public void addAdditionalArg(String... args) {
|
||||
additionalArgs.addAll(Arrays.asList(args));
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ import java.io.OutputStream;
|
|||
|
||||
/**
|
||||
* An Interface defining a custom field parser and writer.
|
||||
* <p></p>
|
||||
* <p>
|
||||
* One singleton instance of the serializer will be instantiated for the lifetime of the
|
||||
* {@link BinaryStructInputStream} and {@link BinaryStructOutputStream} objects.
|
||||
* <p></p>
|
||||
* <p>
|
||||
* NOTE: Partial octet serializing not supported.
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* A stream class that parses a byte stream into binary struct objects.
|
||||
* <p></p>
|
||||
* <p>
|
||||
* Limitations:<br>
|
||||
* - Does not support sub binary objects.<br>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* A stream class that generates a byte stream from a binary struct objects.
|
||||
* <p></p>
|
||||
* <p>
|
||||
* Limitations:<br>
|
||||
* - Does not support sub binary objects.<br>
|
||||
*
|
||||
|
|
|
|||
|
|
@ -104,21 +104,21 @@ public class PluginManager<T> implements Iterable<PluginData>{
|
|||
}
|
||||
|
||||
/**
|
||||
* @return a Iterator of all enabled plugins.
|
||||
* @return an Iterator of all enabled plugins.
|
||||
*/
|
||||
@Override
|
||||
public Iterator<PluginData> iterator() {
|
||||
return new EnabledPluginIterator(toList(plugins.values().iterator()));
|
||||
}
|
||||
/**
|
||||
* @return a Iterator for singleton Objects from all plugins that are enabled and
|
||||
* @return an Iterator for singleton Objects from all plugins that are enabled and
|
||||
* has defined implementations of the given interface.
|
||||
*/
|
||||
public <K> Iterator<K> getSingletonIterator(Class<K> intf) {
|
||||
return new PluginSingletonIterator<>(iterator(), intf);
|
||||
}
|
||||
/**
|
||||
* @return a Iterator for classes from all plugins that are enabled and has defined
|
||||
* @return an Iterator for classes from all plugins that are enabled and has defined
|
||||
* implementations of the given interface.
|
||||
*/
|
||||
public <K> Iterator<Class<? extends K>> getClassIterator(Class<K> intf) {
|
||||
|
|
@ -126,7 +126,7 @@ public class PluginManager<T> implements Iterable<PluginData>{
|
|||
}
|
||||
|
||||
/**
|
||||
* @return a Iterator of all plugins, independently on if they are enabled or disabled.
|
||||
* @return an Iterator of all plugins, independently on if they are enabled or disabled.
|
||||
*/
|
||||
public Iterator<PluginData> iteratorAll() {
|
||||
return plugins.values().iterator();
|
||||
|
|
@ -172,7 +172,7 @@ public class PluginManager<T> implements Iterable<PluginData>{
|
|||
|
||||
|
||||
/**
|
||||
* A Iterator that only returns enabled plugins.
|
||||
* An Iterator that only returns enabled plugins.
|
||||
*/
|
||||
protected static class EnabledPluginIterator implements Iterator<PluginData> {
|
||||
private List<PluginData> pluginList;
|
||||
|
|
@ -232,6 +232,7 @@ public class PluginManager<T> implements Iterable<PluginData>{
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Class<? extends T> next() {
|
||||
if (!hasNext())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue