com.getperka.flatpack.fast.objc.stg Maven / Gradle / Ivy
/*
* #%L
* FlatPack Automatic Source Tool
* %%
* Copyright (C) 2012 Perka Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
entityHeader(entity) ::= <<
// Generated File - DO NOT EDIT
#import \
#import ".h"
;}; wrap, separator="\n">
@interface :
collection while maintaining a proper bi-directional association
*/
- (void)addItemTo:( *)item;}; wrap, separator="\n\n">
@end
>>
entity(entity) ::= <<
// Generated File - DO NOT EDIT
.h"}; wrap, separator="\n">
#import "FPBaseHasUuid.h"
#import "FPEntityDescription.h"
#import "FPProperty.h"
#import "NSObject+FP.h"
@implementation
= _;}; separator="\n">
= _;}; separator="\n">
static FPEntityDescription *_entityDescription;
static NSMutableArray *_allProperties;
+ (void)load {
[super load];
_allProperties = [NSMutableArray array];
_entityDescription = [FPEntityDescription newWithDictionary:@{
@"typeName":@"",
@"superType":[ entityDescription],
@"kind":[ class],
@"properties":_allProperties
}];
[FPEntityDescription setEntityDescription:_entityDescription forName:@""];
}
+ (FPEntityDescription *)entityDescription {
return _entityDescription;
}
// initialize collection properties
- (id)init {
self = [super init];
if(self != nil) {
= [ new];}; separator="\n">
}
return self;
}
@end
>>
entityAccessors(property) ::= <<
// one-to-many accessors to maintain bi-directional relationships
- (NSMutableArray *) {
return _;
}
- (void)set:(NSMutableArray *) {
_ = [ mutableCopy];
[_ enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
[obj setValue:self forKey:@""];
}];
}
- (void)addItemTo:( *)item {
[_ addObject:item];
[item setValue:self forKey:@""];
}
// many-to-one accessors to maintain bi-directional relationships
- ( *){
return _;
}
- (void)set:( *) {
_ = ;
if(![[_ ] containsObject:self]) {
[[_ ] addObject:self];
}
}
>>
property(property) ::= <%
<\n>
@property (}; separator=", ">) *;
%>
propertyAdd(property) ::= <<
//
[_allProperties addObject:
[FPProperty setPropertyForUuid:@""
withDictionary:@{
@"name":@"",
@"embedded":@YES,
@"kind":[ class],
@"impliedProperty":[FPProperty propertyForUuid:@""]
}]];
>>
/**
* Emit a doc string, reflowed to fit the current context.
*/
docString(docString) ::= <<
/**
*/
>>
endpointDeclaration(endpoint) ::= <<
>>
endpointRequestInterface(endpoint) ::= <<
@interface : FPFlatpackRequest
*)with:(NSString *);}; separator="\n">
-()execute;
-(void)executeUsingBlock:()block;
@end
>>
endpointRequestImplementation(endpoint) ::= <<
@implementation
-()execute {
return [self baseExecute];
}
-(void)executeUsingBlock:()block {
[self baseExecuteUsingBlock:^(id result) {
if(block != nil) block(result);
}];
}
@end
>>
endpointWithMethod(p) ::= <<
-( *)with:(NSString *) {
[self setQueryParameterWithName:@"" value:];
return self;
}
>>
apiHeader(api) ::= <<
// Generated File - DO NOT EDIT
#import \
#import "FPBaseApi.h"
#import "FPBaseHasUuid.h"
#import "FPFlatpackRequest.h"
;}; separator="\n">
)();}; separator="\n">
@interface BaseApi : FPBaseApi
;
}; separator="\n">
@end
>>
api(api) ::= <<
// Generated File - DO NOT EDIT
#import "BaseApi.h"
.h"}; separator="\n">
@implementation BaseApi
{
*request = [[ alloc] initWithApi:self
method:@""
path:@""];
pathArgs:@[}; separator=", ">]];
request.setEntity();
return request;
\}}; separator="\n\n">
@end
>>