use of com.robotoworks.mechanoid.db.sqliteModel.ContentUriSegment in project mechanoid by robotoworks.
the class ContentProviderGenerator method asString.
public String asString(final ContentUri uri) {
StringBuilder builder = new StringBuilder();
String _type = uri.getType();
builder.append(_type);
EList<ContentUriSegment> _segments = uri.getSegments();
for (final ContentUriSegment seg : _segments) {
{
builder.append("/");
if ((seg instanceof ContentUriParamSegment)) {
ContentUriParamSegment paramSeg = ((ContentUriParamSegment) seg);
boolean _isNum = paramSeg.isNum();
if (_isNum) {
builder.append("#");
} else {
builder.append("*");
}
} else {
String _name = seg.getName();
builder.append(_name);
}
}
}
return builder.toString();
}
use of com.robotoworks.mechanoid.db.sqliteModel.ContentUriSegment in project mechanoid by robotoworks.
the class ContentProviderContractGenerator method createActionUriBuilderMethod.
public CharSequence createActionUriBuilderMethod(final ActionStatement action) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("public static Uri build");
String _name = action.getName();
String _pascalize = Strings.pascalize(_name);
_builder.append(_pascalize, "");
_builder.append("Uri(");
ContentUri _uri = action.getUri();
String _methodArgs = this.toMethodArgs(_uri);
_builder.append(_methodArgs, "");
_builder.append(") {");
_builder.newLineIfNotEmpty();
_builder.append("\t");
_builder.append("return BASE_CONTENT_URI");
_builder.newLine();
_builder.append("\t\t");
_builder.append(".buildUpon()");
_builder.newLine();
_builder.append("\t\t");
_builder.append(".appendPath(\"");
ContentUri _uri_1 = action.getUri();
String _type = _uri_1.getType();
_builder.append(_type, "\t\t");
_builder.append("\")");
_builder.newLineIfNotEmpty();
{
ContentUri _uri_2 = action.getUri();
EList<ContentUriSegment> _segments = _uri_2.getSegments();
for (final ContentUriSegment seg : _segments) {
{
if ((seg instanceof ContentUriParamSegment)) {
{
boolean _isNum = ((ContentUriParamSegment) seg).isNum();
if (_isNum) {
_builder.append("\t\t");
_builder.append(".appendPath(String.valueOf(");
String _name_1 = ((ContentUriParamSegment) seg).getName();
String _camelize = Strings.camelize(_name_1);
_builder.append(_camelize, "\t\t");
_builder.append("))");
_builder.newLineIfNotEmpty();
} else {
_builder.append("\t\t");
_builder.append(".appendPath(");
String _name_2 = ((ContentUriParamSegment) seg).getName();
String _camelize_1 = Strings.camelize(_name_2);
_builder.append(_camelize_1, "\t\t");
_builder.append(")");
_builder.newLineIfNotEmpty();
}
}
} else {
_builder.append("\t\t");
_builder.append(".appendPath(\"");
String _name_3 = seg.getName();
_builder.append(_name_3, "\t\t");
_builder.append("\")");
_builder.newLineIfNotEmpty();
}
}
}
}
_builder.append("\t\t");
_builder.append(".build();");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.newLine();
return _builder;
}
Aggregations