jsolve / sweetener Goto Github PK
View Code? Open in Web Editor NEWA set of classes to facilitate the work with the Java language.
A set of classes to facilitate the work with the Java language.
Implementation of the truncate method:
public static List<?> truncate(List<?> list, int from, int to)
This method should return sub-list of list passed as first parameter. The possible value of to
is -1 which indicates list.size()-1
.
For example:
Person {
id, name, age
}
List ids = Lists.toString(persons, 'id'); // should return only list of ids
AnnotationDrivenMapper cannot map collections of mappable objects.
Suppose we have a class StudentWithListOfGrades
that looks like follows:
class StudentWithListOfGrades {
List<Grade> grades;
}
and a class StudentWithListOfGradeSnapshots
:
class StudentWithListOfGradeSnapshots {
List<GradeSnapshot> gradeSnapshots;
}
Assuming Grade
is mappable to GradeSnapshot
, properly annotated and working with AnnotationDrivenMapper I would like to map StudentWithListOfGrades
to StudentWithListOfGradeSnapshots
. Currently it's not possible.
Sources are not properly formatted. Please use our formatter on every single file in our project.
Please wait for other branches to merge to master. We'd like to avoid unnecessary merging work.
// For all number types!
Currently we have no feedback whether our project still builds after merge. Please configure Jenkins CI (for branch master).
Things you should concentrate on:
You can also add other plugins like Chuck Norris Plugin and Green Balls.
Propose eclipse formatter settings for this project.
Create Arrays class with following methods:
As in the title
Introduce main classes responsible for collection utils.
As in the title
AnnotationDrivenMapper cannot map java.util.Map of mappable objects.
Suppose we have a class StudentWithGrades
that looks like follows:
class StudentWithGrades {
Map<Exam, Grade> grades;
}
and a class StudentWithGradeSnapshots
:
class StudentWithGradeSnapshots {
Map<ExamSnapshot, GradeSnapshot> gradeSnapshots;
}
Assuming Grade
is mappable to GradeSnapshot
and Exam
to ExamSnapshot
, fields are properly annotated and working with AnnotationDrivenMapper, I would like to map StudentWithGrades
to StudentWithGradeSnapshots
. Currently it's not possible.
Proposed methods:
Random
Distance
Normalization
Statistics
Contains restrictions doesn't work with Array and Map
Add the following aggregate functions:
Wyciagnięcie z sweetenera i utworzenie nowego projektu
Implement the following methods for class Reflections.class
:
// returns fields (including private) annotated by given annotation
public static List<Field> getFieldsAnnotatedBy(Object object, Class<? extends Annotation> annotation);
// returns methods (including private) annotated by given annotation
public static List<Method> getMethodsAnnotatedBy(Object object, Class<? extends Annotation> annotation);
// (...)
// return fields satisfying condition
public static List<Field> getFieldsSatisfyingCondition(Object object, Condition<Field> fieldCondition)
// return methods satisfying condition
public static List<Method> getMethodsSatisfyingCondtion(Object object, Condition<Method> methodsCondition);
// (...)
public interface Condition<T> {
boolean isSatisfied(T object);
}
Split string of numbers to array
Resizing
W tej chwili mamy możliwość tworzenia zapytania tylko w postaci
where A=1 AND B=2 AND C=3
Należy dodać możliwość konstrukcji:
where (A=2 OR A=3) AND (C=3 OR D=5)
Well-known problem is finding resources from code.
Proposed methods:
This class should also allow you to save data in various forms:
Proposed methods:
@tkurylek Any suggestions are welcome!
[x] notBetween
[x] in
[x] notIn
[x] before (Date, LocalDate, DateTime, LocalDateTime ... )
[x] after (Date, LocalDate, DateTime, LocalDateTime ... )
Mapy także powinny być obsługiwane przez CollectionCriteria
Powinna byc możliwość tworzenia criteri na kluczu oraz wartosciach
I've got idea to create new types of collection, for example:
Graph (you know what I mean 😋 )
Tuple (something like part of table, known from SQL)
Feel free to editing of the description and adding the new types of collection.
Wiki for collection is not up-to-date. (missing pagination, chop)
This issue should be done after SW-22
Objects class should contain the following methods:
equals(Object, Object) - compare two objects (possible null value)
equals(Object, Object, String) - compare specific property of objects passed as third argument. (possible hierarchical path. eg: company.address.city)
equals(Object, String, Object, String) - compare specific property of objects passed as second (for first object) and fourth (for second object) argument. (possible hierarchical path. eg: company.address.city)
Implement two type of histogram:
DiscreteHistogram();
RangeHistogram(double[] ranges);
Suppose we have class Foo
that is mappable to classes: A
, B
, C
. We want to map bar
field only to A
and B
classes. The following code works but we need to specify two different mappings - one for A
class and one for B
.
@MappableTo(A.class, B.class, C.class)
class Foo {
@Mappings({
@Map(to = "bar", of = A.class),
@Map(to = "bar", of = B.class)
})
Bar bar;
}
I would like to specify multiple classes in @Map(of=...)
parameter so the code looks like this:
@MappableTo(A.class, B.class, C.class)
class Foo {
@Map(to = "bar", of = {A.class, B.class})
Bar bar;
}
For example:
Collections.newArrayList();
Collections.newArrayList("A", "B", "C");
etc...
What do you think about following case:
As user I would like to map one class to many other classes.
In my opinion, the annotation @MapExactlyTo may contains annother optional value : class.
or instead of class as parameter we might receive symbolic name:
@MappableTo(class = StudentSnapshot.class, symbolicName = "studentSnapshot")
@MapExactlyTo(field = "semester", symbolicName = "studentSnapshot")
private int semester;
These classes should allow user to getting time in many variants of time (h, min, s, ms, us etc).
These classes shouldn't have static methods!
Consider Pagination for collection passed as parameter.
The pagination method should return Pagination object:
public static Pagination paginate(Collection, int page, int resultsPerPage);
class Pagination {
int page;
int resultPerPage;
int numberOfPage;
Collection<T> elementsOfPage;
}
or maybe the better idea is:
class Pagination {
int page;
int resultPerPage;
int numberOfPage;
List<Collection<T> > listOfPages;
Collection<T> getElementsOfPage();
nextPage();
previousPage();
etc...
}
@tkurylek What do you think about it? In your opinion which option is better?
Please, have a look at ignored test AnnotationDrivenMapperTest.java :: shouldMapStudentToStudentSnapshot
Create Maps class based on Collections.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.