Commit Graph

615 Commits

Author SHA1 Message Date
Michael Bayne eaadb3228a Added support for non-ByteEnum enums, which are stored using their string name. 2010-12-01 19:36:01 +00:00
Michael Bayne 6365f290d9 Put our templates in src/main/resources. 2010-11-20 02:50:38 +00:00
Charlie Groves c70cf7c1c6 Fix column indices in hsqldb. Like mysql, it can't handle parenthesis around its index column expressions. 2010-11-18 00:48:20 +00:00
Michael Bayne 1b1792aabe Hah! Perhaps there was some use in having the class be named. However, I'm not
sure what this is really testing. If the CRUD test with CustomType works, then
transforming field marshallers work, so why do we need to make sure they have a
specific class name?
2010-10-25 20:16:40 +00:00
Michael Bayne 2db4506a2b Nixed extra space. 2010-10-25 20:15:55 +00:00
Michael Bayne c7b60a1de8 No value in having the transforming marshaller be a named class. Switch to
slightly more concise code.
2010-10-25 20:09:37 +00:00
Michael Bayne 5046c1d906 Unused import trimming. Type parameter cleanup. 2010-10-25 19:55:27 +00:00
Michael Bayne ec04d618c4 Nixed vestigial methods. 2010-10-25 19:53:34 +00:00
Charlie Groves c564c36e3a Headerz 2010-10-19 00:37:42 +00:00
Charlie Groves a649efac99 Missing @Overrides, extra imports 2010-10-19 00:33:31 +00:00
Charlie Groves 9368da4ebf Skip classes in GenRecordTask if they have @GeneratedValue on a field without @Id. I'd rather stop
the build, but other errors in class processing seem to lead to skipping, so I'm not rocking the
boat.

If @GeneratedValue is on a field without an @Id, depot creates the necessary indices to generate the
value, but it doesn't actually do the generation on insertion.  Rather than making it work without a
good use case for it, I'm adding this check to keep people from stumbling into a broken design.
2010-10-19 00:29:31 +00:00
Ray Greenwell 92c201575d Update the tests.
One test no longer works, because the StringArray transformer now inherits
the fromPersistent method from StringBase, and has a generic return type.
Perhaps we can update FieldMarshaller to deal with Types instead of classes
when validating... But for now I did what all bad programmers do when a test
fails: comment it out.
2010-10-12 20:39:07 +00:00
Ray Greenwell dcd4046c60 Transformer rejigger.
Transformer is now an abstract class with a default init() method.
The Type parameter has been removed from fromPersistent().
The Transformer annotation now has some new attributes that
can be used to hint whether you want a result that is immutable or interned,
the meaning and support of both is completely up to the Transformer.
Brought back my uber Iterable<String> transformers, with immutable/intern
support in a single Transformer.
 - interning will intern the strings
 - immutable will wrap the collections in Collections.unmodifiable*
   (using a guava Immutable collection ends up creating a temporary
    builder collection and then copying the elements)
 - if immutable AND interning then the collection itself is
   "interned".
At some point I'll add support for nearly any Iterable
of an otherwise supported type, so that our Records can have
List<Integer> and other such fields.
2010-10-12 19:35:07 +00:00
Ray Greenwell 2ff3bac12d Look for any worthy method, even in superclasses. 2010-10-01 01:29:46 +00:00
Ray Greenwell c7eb6f56ef Roll this back until I do some more testing.. :( 2010-09-30 22:25:16 +00:00
Ray Greenwell 89bec13aa2 Added Transformers that will always return immutable collections,
interned Strings, or both.
I may rework this into attributes that can be specified for any
@Transformer annotation, and leave it up to each Transformer
whether they are honored (and how).
2010-09-30 21:30:59 +00:00
Ray Greenwell 9fafebd487 Support creating arrays of java.sql.Date. 2010-09-29 18:31:31 +00:00
Ray Greenwell 020d33c8aa Was looking at how some things work and made a few drive-by optimizations
to FindAllQuery.
- We don't need to destructively modify the Set of keys to fetch if we hold
  on to one iterator.
- We can create an ArrayList that won't need to grow if our keys Iterable
  happens to be a Collection.
- And, just generally prefer Lists factories to specific constructors.
2010-09-20 23:21:06 +00:00
Andrzej Kapolka 8c5f333f73 Is there a reason why this didn't return TIME? It seems to work. 2010-09-17 02:46:17 +00:00
Michael Bayne 07e4bdec4a Move overview.html to a place where Maven's javadoc plugin will find it. 2010-09-09 20:31:51 +00:00
Michael Bayne 33f6351af5 Add link to project website to docs. 2010-09-09 20:28:34 +00:00
Michael Bayne 0fea1dfb07 Nix link since we're not including protected bits in the docs. 2010-09-09 20:27:18 +00:00
Michael Bayne 5fe094a804 Import needed for Javadoc comment. 2010-09-09 05:26:16 +00:00
Michael Bayne 3f7a7be9da Some Javadoc fixing. Though it's very annoying that I have to use &#064;
instead of @. Thanks for making things totally unreadable in the source file
javadoc. How about \@ instead?
2010-08-27 18:11:22 +00:00
Michael Bayne 28f9439b5f More layout standardizing. 2010-08-27 17:49:18 +00:00
Michael Bayne 6778ada227 Moving toward more standard project layout. 2010-08-27 17:47:07 +00:00
Michael Bayne 5a97565eaa New HSQLDB requires length for VARBINARY. 2010-08-27 17:41:11 +00:00
Andrzej Kapolka 2471487d2f Oops, that will never be null. 2010-08-18 22:43:33 +00:00
Andrzej Kapolka af0c636517 More fixes for named columns. DepotMarshaller expects the names of the
columns in the results to match the FieldMarshaller column names, so we have
to use those rather than the field names.  Also, shadowed fields need to use
the column names of the fields that they're shadowing.
2010-08-18 22:40:03 +00:00
Andrzej Kapolka 061219bc57 Postgres returns a timestamp from date_trunc, whereas MySQL returns a
date from date().  We should probably just modify DateFuncs.date to
return a date in both cases (perhaps with a separate DateFun.DateCast
class), but for now it's easier to have MySQL return a timestamp as
well.
2010-07-22 21:37:11 +00:00
Andrzej Kapolka 27ff0f6f55 And this should be getting the column name, too (though it doesn't
actually do anything yet except log a message).
2010-07-15 00:50:59 +00:00
Andrzej Kapolka cd94a13551 While I'm in there, this also looks wrong. 2010-07-15 00:30:40 +00:00
Andrzej Kapolka 5dd3ae92a5 Looks like this should be the column name, not the field name. 2010-07-15 00:22:28 +00:00
Ray Greenwell c7ce640a78 Prefer Guava to Samskivert. 2010-07-14 18:51:40 +00:00
Ray Greenwell 9d83cc96a5 For the String[] transformer, encode null elements as "\" followed by
the terminator (we encode the terminator as a different character).
This is somewhat nicer when inspecting an encoded String, and allows
for a future in which the decoder easily counts the number of terminator
characters and pre-allocates the storage, if we so desired.
2010-07-06 20:54:48 +00:00
Ray Greenwell 95f2fc6938 A Transformer from a Set<ByteEnum> -> Integer, plus some new tests. 2010-07-06 18:30:32 +00:00
Michael Bayne 5ec15839d3 Factored shared code into a base class. Restructured to avoid double checking
for null.
2010-07-06 18:22:09 +00:00
Michael Bayne 0b84e08917 Nixed deprecated transformer. 2010-07-06 18:15:37 +00:00
Ray Greenwell 20e06e9789 Ready my Transformer for prime time.
There are some optimizations that could probably be made, but
for now I defer to the new One Rule of Optimization:
"Do not optimize for performance unless it does not weird the code or
it Really Matters".
2010-07-05 22:43:13 +00:00
Ray Greenwell 2b71609148 I should change the name of this test... 2010-07-05 22:36:18 +00:00
Ray Greenwell 48279471e1 Updated tests. 2010-07-05 22:34:15 +00:00
Ray Greenwell eef66bcaee Changed my String[] Transformer:
- continue to terminate Strings with a newline
- turn newlines inside a String into "\n"
- turn null elements into "\0".

This is one additional character when encoding nulls, but
I think it may improve readability..
2010-07-05 22:10:56 +00:00
Michael Bayne 0e82904696 Provide the Transformer with the field's Type rather than it's Class. The Type
contains generic type information which would allow a transformer to do the
right thing with a field of, say, type Set<Integer>.

If we had unit tests for StringIterable, I'd know that I didn't just break it.
I'd also know that it worked in the first place. :)
2010-07-05 21:43:10 +00:00
Ray Greenwell a5fee01354 Maybe I can generalize this into a rule: if either of operands 2 or 3
to the ternary operator are boolean constants, don't use the ternary operator.

a ? true : x   ==  a || x
a ? x : true   ==  !a || x
a ? false : x  ==  !a && x
a ? x : false  ==  a && x
2010-07-05 21:32:28 +00:00
Ray Greenwell f2f995766b A demonstration of the failing of the current String[] transformer.
I'll do some more tests and nix this one today.
2010-07-05 14:16:00 +00:00
Ray Greenwell ce1d06e82b I was trying to be clever with newline and save a character,
but I forgot about that cleverness in fromPersistent, so skip it for now.
2010-07-02 03:56:26 +00:00
Ray Greenwell f4c7b7fef4 Better String[] Transformer, RFC. 2010-07-02 03:49:43 +00:00
Par Winzell 846ea920b6 Make the adapter configurable, as was always the intention. 2010-07-01 17:15:32 +00:00
Par Winzell a0e8c602ed Maintain correct record counts for cacheless finds. 2010-06-24 18:15:40 +00:00
Michael Bayne 75a22f5584 Nix joiner. 2010-06-19 18:05:46 +00:00