blob: 842fa0d31d1d4b7b667d20d65c2fc1136a5fa574 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
package org.netbeans.modules.websvc.saas.codegen.j2ee;
import org.netbeans.modules.websvc.saas.model.CustomSaasMethod;
import javax.swing.text.Document;
import org.netbeans.modules.editor.NbEditorUtilities;
import org.netbeans.modules.websvc.saas.codegen.Constants;
import org.netbeans.modules.websvc.saas.codegen.j2ee.support.J2eeUtil;
import org.netbeans.modules.websvc.saas.codegen.model.SaasBean;
import org.netbeans.modules.websvc.saas.model.SaasMethod;
/**
* Code generator for REST services wrapping custom service.
*
* @author Ayub Khan
*/
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.modules.websvc.saas.codegen.spi.SaasClientCodeGenerationProvider.class)
public class CustomClientRestResourceCodeGenerator extends CustomClientServletCodeGenerator {
public CustomClientRestResourceCodeGenerator() {
setDropFileType(Constants.DropFileType.RESOURCE);
setPrecedence(1);
}
@Override
public boolean canAccept(SaasMethod method, Document doc) {
if (SaasBean.canAccept(method, CustomSaasMethod.class, getDropFileType()) &&
J2eeUtil.isRestJavaFile(NbEditorUtilities.getDataObject(doc))) {
return true;
}
return false;
}
}