diff --git a/src/zutil/db/bean/DBBean.java b/src/zutil/db/bean/DBBean.java index edbe75d..d3dd64d 100755 --- a/src/zutil/db/bean/DBBean.java +++ b/src/zutil/db/bean/DBBean.java @@ -128,9 +128,10 @@ public abstract class DBBean { * Saves the bean and all its sub beans to the DB * * @param db is the DBMS connection + * @throws SQLException if there is any issue with the SQL query */ public void save(DBConnection db) throws SQLException{ - save( db, true ); + save(db, true); } /** @@ -138,6 +139,7 @@ public abstract class DBBean { * * @param db the DBMS connection * @param recursive if all sub beans should be saved also + * @throws SQLException if there is any issue with the SQL query */ @SuppressWarnings("unchecked") public void save(DBConnection db, boolean recursive) throws SQLException{ @@ -274,6 +276,9 @@ public abstract class DBBean { /** * Deletes the bean from the DB and all its sub beans and links. + * + * @param db the DBMS connection + * @throws SQLException if there is any issue with the SQL query */ public void delete(DBConnection db) throws SQLException{ delete(db, true); @@ -281,7 +286,9 @@ public abstract class DBBean { /** * Deletes the bean from the DB and the links to sub beans. * + * @param db the DBMS connection * @param recursive if all sub beans should be deleted also + * @throws SQLException if there is any issue with the SQL query */ public void delete(DBConnection db, boolean recursive) throws SQLException{ Class c = this.getClass(); @@ -324,9 +331,11 @@ public abstract class DBBean { /** * Loads all rows from the table into a LinkedList * - * @param is the class of the bean - * @param c is the class of the bean - * @return a LinkedList with all the beans in the DB + * @param is the class of the bean + * @param db the DBMS connection + * @param c is the class of the bean + * @return a LinkedList with all the beans in the DB + * @throws SQLException if there is any issue with the SQL query */ public static List load(DBConnection db, Class c) throws SQLException { // Initiate a BeanConfig if there is non @@ -343,9 +352,11 @@ public abstract class DBBean { * Loads a specific instance of the bean from the table with the specific id * * @param is the class of the bean + * @param db the DBMS connection * @param c is the class of the bean * @param id is the id value of the bean - * @return a DBBean Object with the specific id or null if the id was not found + * @return a DBBean Object with the specific id or null if the id was not found + * @throws SQLException if there is any issue with the SQL query */ public static T load(DBConnection db, Class c, long id) throws SQLException { // Initiate a BeanConfig if there is non @@ -363,9 +374,13 @@ public abstract class DBBean { /** * Creates a specific table for the given Bean, * WARNING: Experimental + * + * @param db the DBMS connection + * @param c is the class of the bean + * @throws SQLException if there is any issue with the SQL query */ - public static void create(DBConnection sql, Class c) throws SQLException{ - DBBeanConfig config = DBBeanConfig.getBeanConfig( c ); + public static void create(DBConnection db, Class c) throws SQLException{ + DBBeanConfig config = DBBeanConfig.getBeanConfig(c); // Generate the SQL StringBuilder query = new StringBuilder(); @@ -373,7 +388,7 @@ public abstract class DBBean { // ID query.append(" ").append(config.getIdColumnName()).append(" "); - query.append( classToDBType( Long.class ) ); + query.append(classToDBType(Long.class)); query.append(" PRIMARY KEY AUTO_INCREMENT, "); for( DBBeanFieldConfig field : config.getFields() ){ @@ -385,8 +400,8 @@ public abstract class DBBean { query.delete(query.length()-2, query.length()); query.append(")"); - logger.finest("Create Bean("+c.getName()+") query: "+sql.toString()); - PreparedStatement stmt = sql.getPreparedStatement( sql.toString() ); + logger.finest("Create Bean("+c.getName()+") query: " + db.toString()); + PreparedStatement stmt = db.getPreparedStatement(db.toString()); // Execute the SQL DBConnection.exec(stmt); diff --git a/src/zutil/io/file/FileSearcher.java b/src/zutil/io/file/FileSearcher.java index db798ef..91d84e3 100755 --- a/src/zutil/io/file/FileSearcher.java +++ b/src/zutil/io/file/FileSearcher.java @@ -72,6 +72,8 @@ public class FileSearcher implements Iterable{ /** * Sets the file extensions to search for (should not include . at the beginning) + * + * @param ext is a String containing the file extension */ public void setExtension(String ext){ extension = ext; diff --git a/src/zutil/net/dns/MulticastDnsServer.java b/src/zutil/net/dns/MulticastDnsServer.java index 1fcc548..289c4d1 100755 --- a/src/zutil/net/dns/MulticastDnsServer.java +++ b/src/zutil/net/dns/MulticastDnsServer.java @@ -85,6 +85,7 @@ public class MulticastDnsServer extends ThreadedUDPNetwork implements ThreadedUD * @param name is the domain name to add the entry under * @param type {@link zutil.net.dns.packet.DnsConstants.TYPE} * @param clazz {@link zutil.net.dns.packet.DnsConstants.CLASS} + * @param data is the payload to include in client response */ public void addEntry(String name, int type, int clazz, byte[] data){ DnsPacketResource resource = new DnsPacketResource(); diff --git a/src/zutil/net/threaded/ThreadedUDPNetwork.java b/src/zutil/net/threaded/ThreadedUDPNetwork.java index db7a611..cb1335f 100755 --- a/src/zutil/net/threaded/ThreadedUDPNetwork.java +++ b/src/zutil/net/threaded/ThreadedUDPNetwork.java @@ -77,6 +77,7 @@ public class ThreadedUDPNetwork extends Thread{ * * @param port is the port that the server should listen to * @param multicastAddr is the multicast address that the server will listen on + * @throws IOException if there is any issue opening the connection */ public ThreadedUDPNetwork(String multicastAddr, int port ) throws IOException{ this.type = UDPType.MULTICAST; @@ -109,8 +110,9 @@ public class ThreadedUDPNetwork extends Thread{ * Sends the given packet * * @param packet is the packet to send + * @throws IOException if there is any issue with sending the packet */ - public synchronized void send( DatagramPacket packet ) throws IOException{ + public synchronized void send(DatagramPacket packet) throws IOException { socket.send(packet); } @@ -119,7 +121,7 @@ public class ThreadedUDPNetwork extends Thread{ * * @param thread is the thread */ - public void setThread(ThreadedUDPNetworkThread thread){ + public void setThread(ThreadedUDPNetworkThread thread) { this.thread = thread; } diff --git a/src/zutil/parser/binary/BinaryStruct.java b/src/zutil/parser/binary/BinaryStruct.java index 2a0b0ac..3946e7d 100755 --- a/src/zutil/parser/binary/BinaryStruct.java +++ b/src/zutil/parser/binary/BinaryStruct.java @@ -43,9 +43,9 @@ public interface BinaryStruct { @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) @interface BinaryField{ - /** Will be used to order the fields are read. Lowest index number field will be read first. */ + /** @return a number indicating the order the fields are read. Lowest index number field will be read first. */ int index(); - /** Defines the bit length of the data */ + /** @return the bit length of the data */ int length(); } @@ -57,12 +57,12 @@ public interface BinaryStruct { @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) @interface VariableLengthBinaryField{ - /** Will be used to order the fields are read. Lowest index number field will be read first. */ + /** @return a number indicating the order the fields are read. Lowest index number field will be read first. */ int index(); - /** The name of the field that will contain the length of the data to read. */ + /** @return a String name of the field that contains the length of the data to be read. */ String lengthField(); - /** Defines the multiplier used on the lengthField parameter to convert the length in bits to - * a user defined value. Default value is 8 (which converts length to nr of bytes). */ + /** @return the multiplier used on the lengthField parameter to convert the length in bits to + * a user defined value. Default value is 8 (which converts length to number of bytes). */ int multiplier() default 8; } @@ -72,9 +72,9 @@ public interface BinaryStruct { @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) @interface CustomBinaryField{ - /** Will be used to order the fields are read. Lowest index number field will be read first. */ + /** @return a number indicating the order the fields are read. Lowest index number field will be read first. */ int index(); - /** Defines the serializer class that will be used. Class needs to be publicly visible. */ + /** @return the serializer class name that will be used. Class needs to be publicly visible. */ Class serializer(); } }