Skip to content

Commit

Permalink
Renamed plugins API.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed May 7, 2015
1 parent 8b00476 commit 229973c
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion rapidoid-app/src/main/java/org/rapidoid/app/AppGUI.java
Expand Up @@ -70,7 +70,7 @@ public static <T> GridWidget grid(Class<T> type) {
}

public static <T> GridWidget grid(String type) {
return grid(Plugins.entity().getEntityType(type));
return grid(Plugins.entities().getEntityType(type));
}

public static <T> GridWidget grid(Predicate<T> match) {
Expand Down
Expand Up @@ -211,7 +211,7 @@ protected Object genericScreen() {
if (m.find()) {
String type = m.group(1);

Class<?> entityType = Plugins.entity().getEntityType(type);
Class<?> entityType = Plugins.entities().getEntityType(type);
if (entityType == null || !Metadata.isAnnotated(entityType, Scaffold.class)) {
return null;
}
Expand Down Expand Up @@ -243,8 +243,8 @@ protected Object genericScreen() {
if (m.find()) {
String type = m.group(1);

String type2 = U.or(Plugins.language().pluralToSingular(type), type);
Class<?> entityType = Plugins.entity().getEntityType(type2);
String type2 = U.or(Plugins.languages().pluralToSingular(type), type);
Class<?> entityType = Plugins.entities().getEntityType(type2);
if (entityType == null || !Metadata.isAnnotated(entityType, Scaffold.class)) {
return null;
}
Expand Down
Expand Up @@ -50,7 +50,7 @@ public Object content() {
Tag caption = titleBox(entityName + " List");
GridWidget grid = grid(entityType, 10);

boolean canAdd = Secure.canInsert(Secure.username(), Plugins.entity().create(entityType));
boolean canAdd = Secure.canInsert(Secure.username(), Plugins.entities().create(entityType));
ButtonWidget btnAdd = canAdd ? btn("Add " + entityName).primary().command("Add") : null;

return row(caption, grid, btnAdd);
Expand Down
Expand Up @@ -42,7 +42,7 @@ public NewEntityScreenGeneric(Class<?> entityType) {
}

public Object content() {
target = Plugins.entity().create(entityType);
target = Plugins.entities().create(entityType);

Tag caption = h2("New " + U.capitalized(ctx().pathSegment(0).substring(3)));
FormWidget form = create(target).buttons(SAVE, CANCEL);
Expand Down
Expand Up @@ -32,7 +32,7 @@
* @author Nikolche Mihajlovski
* @since 3.0.0
*/
public interface DbPlugin {
public interface DBPlugin {

long insert(Object entity);

Expand Down
Expand Up @@ -24,7 +24,7 @@
* @author Nikolche Mihajlovski
* @since 3.0.0
*/
public interface EntityPlugin {
public interface EntitiesPlugin {

Class<?> getEntityType(String simpleTypeName);

Expand Down
Expand Up @@ -24,7 +24,7 @@
* @author Nikolche Mihajlovski
* @since 3.0.0
*/
public interface LanguagePlugin {
public interface LanguagesPlugin {

String singularToPlural(String noun);

Expand Down
Expand Up @@ -30,11 +30,11 @@ public static DbPlugin db() {
return null;
}

public static EntityPlugin entity() {
public static EntitiesPlugin entities() {
return null;
}

public static LanguagePlugin language() {
public static LanguagesPlugin languages() {
return null;
}

Expand Down
Expand Up @@ -30,11 +30,11 @@
import org.rapidoid.lambda.Callback;
import org.rapidoid.lambda.Operation;
import org.rapidoid.lambda.Predicate;
import org.rapidoid.plugins.DbPlugin;
import org.rapidoid.plugins.DBPlugin;

@Authors("Nikolche Mihajlovski")
@Since("3.0.0")
public class InMemDbPlugin implements DbPlugin {
public class InMemDbPlugin implements DBPlugin {

@Override
public long insert(Object entity) {
Expand Down

0 comments on commit 229973c

Please sign in to comment.