本文整理汇总了Java中org.eclipse.xtend.lib.macro.declaration.ClassDeclaration类的典型用法代码示例。如果您正苦于以下问题:Java ClassDeclaration类的具体用法?Java ClassDeclaration怎么用?Java ClassDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassDeclaration类属于org.eclipse.xtend.lib.macro.declaration包,在下文中一共展示了ClassDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasSuperEquals
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public boolean hasSuperEquals(final ClassDeclaration cls) {
boolean _xblockexpression = false;
{
Type _type = cls.getExtendedClass().getType();
final ClassDeclaration superClass = ((ClassDeclaration) _type);
boolean _xifexpression = false;
boolean _equals = this.context.newTypeReference(superClass).equals(this.context.getObject());
if (_equals) {
_xifexpression = false;
} else {
boolean _xifexpression_1 = false;
boolean _hasEquals = this.hasEquals(superClass);
if (_hasEquals) {
_xifexpression_1 = true;
} else {
_xifexpression_1 = this.hasSuperEquals(superClass);
}
_xifexpression = _xifexpression_1;
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
示例2: hasSuperHashCode
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public boolean hasSuperHashCode(final ClassDeclaration cls) {
boolean _xblockexpression = false;
{
Type _type = cls.getExtendedClass().getType();
final ClassDeclaration superClass = ((ClassDeclaration) _type);
boolean _xifexpression = false;
boolean _equals = this.context.newTypeReference(superClass).equals(this.context.getObject());
if (_equals) {
_xifexpression = false;
} else {
boolean _xifexpression_1 = false;
boolean _hasHashCode = this.hasHashCode(superClass);
if (_hasHashCode) {
_xifexpression_1 = true;
} else {
_xifexpression_1 = this.hasSuperHashCode(superClass);
}
_xifexpression = _xifexpression_1;
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
示例3: simpleInterfaceName
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public String simpleInterfaceName(final ClassDeclaration cls) {
String _xblockexpression = null;
{
final String simpleName = cls.getSimpleName();
String _xifexpression = null;
boolean _startsWith = simpleName.startsWith("Default");
if (_startsWith) {
_xifexpression = simpleName.substring(7);
} else {
String _xifexpression_1 = null;
boolean _endsWith = simpleName.endsWith("Impl");
if (_endsWith) {
int _length = simpleName.length();
int _minus = (_length - 4);
_xifexpression_1 = simpleName.substring(0, _minus);
} else {
throw new IllegalArgumentException(
"Class name must start with \'Default\' or end with \'Impl\'");
}
_xifexpression = _xifexpression_1;
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
示例4: persistentState
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
/**
* All non-static, non-transient fields of this class
*/
public static Iterable<? extends FieldDeclaration> persistentState(final ClassDeclaration cls) {
Iterable<? extends FieldDeclaration> _declaredFields = cls.getDeclaredFields();
final Function1<FieldDeclaration,Boolean> _function = new Function1<FieldDeclaration,Boolean>() {
public Boolean apply(final FieldDeclaration it) {
boolean _and = false;
boolean _isTransient = it.isTransient();
boolean _not = (!_isTransient);
if (!_not) {
_and = false;
} else {
boolean _isStatic = it.isStatic();
boolean _not_1 = (!_isStatic);
_and = (_not && _not_1);
}
return Boolean.valueOf(_and);
}
};
Iterable<? extends FieldDeclaration> _filter = IterableExtensions.filter(_declaredFields, _function);
return _filter;
}
示例5: newWildCardSelfTypeReference
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
private TypeReference newWildCardSelfTypeReference(final ClassDeclaration cls) {
final Function1<TypeParameterDeclaration, TypeReference> _function = new Function1<TypeParameterDeclaration, TypeReference>() {
@Override
public TypeReference apply(final TypeParameterDeclaration it) {
return Util.this.context.newWildcardTypeReference(Util.this.context.getObject());
}
};
return this.context.newTypeReference(cls, ((TypeReference[])Conversions.unwrapArray(IterableExtensions.map(cls.getTypeParameters(), _function), TypeReference.class)));
}
示例6: getSuperConstructor
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public ResolvedConstructor getSuperConstructor(final TypeDeclaration it) {
if ((it instanceof ClassDeclaration)) {
if ((Objects.equal(((ClassDeclaration)it).getExtendedClass(), this.context.getObject()) || (((ClassDeclaration)it).getExtendedClass() == null))) {
return null;
}
return IterableExtensions.head(((ClassDeclaration)it).getExtendedClass().getDeclaredResolvedConstructors());
} else {
return null;
}
}
示例7: getToStringConfig
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public ToStringConfiguration getToStringConfig(final ClassDeclaration it) {
ToStringConfiguration _xblockexpression = null;
{
final AnnotationReference anno = it.findAnnotation(this.context.findTypeGlobally(ToString.class));
ToStringConfiguration _xifexpression = null;
if ((anno == null)) {
_xifexpression = null;
} else {
_xifexpression = new ToStringConfiguration(anno);
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
示例8: getAdapterClassName
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public String getAdapterClassName(final ClassDeclaration declaration) {
String _qualifiedName = declaration.getQualifiedName();
String _plus = (_qualifiedName + ".");
String _simpleName = declaration.getSimpleName();
String _plus_1 = (_plus + _simpleName);
return (_plus_1 + "Adapter");
}
示例9: hasExecutable
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public static boolean hasExecutable(final ClassDeclaration cls, final Signature sig) {
Iterable<? extends MemberDeclaration> _declaredMembers = cls.getDeclaredMembers();
Iterable<ExecutableDeclaration> _filter = Iterables.<ExecutableDeclaration>filter(_declaredMembers, ExecutableDeclaration.class);
final Function1<ExecutableDeclaration, Boolean> _function = (ExecutableDeclaration it) -> {
Signature _signature = CommonQueries.signature(it);
return Boolean.valueOf(Objects.equal(_signature, sig));
};
return IterableExtensions.<ExecutableDeclaration>exists(_filter, _function);
}
示例10: hasDataConstructor
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public static boolean hasDataConstructor(final ClassDeclaration cls) {
Iterable<? extends FieldDeclaration> _persistentState = CommonQueries.persistentState(cls);
final Function1<FieldDeclaration, TypeReference> _function = (FieldDeclaration it) -> {
return it.getType();
};
Iterable<TypeReference> _map = IterableExtensions.map(_persistentState, _function);
Signature _constructorSignature = CommonQueries.constructorSignature(cls, ((TypeReference[])Conversions.unwrapArray(_map, TypeReference.class)));
return CommonQueries.hasExecutable(cls, _constructorSignature);
}
示例11: hasEquals
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public static boolean hasEquals(final ClassDeclaration cls) {
Iterable<? extends MethodDeclaration> _declaredMethods = cls.getDeclaredMethods();
final Function1<MethodDeclaration, Boolean> _function = (MethodDeclaration it) -> {
return Boolean.valueOf(((Objects.equal(it.getSimpleName(), "equals") && (IterableExtensions.size(it.getParameters()) == 1)) &&
Objects.equal(IterableExtensions.head(it.getParameters()).getType().getName(), "java.lang.Object")));
};
return IterableExtensions.exists(_declaredMethods, _function);
}
示例12: hasGetter
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public static boolean hasGetter(final FieldDeclaration field) {
TypeDeclaration _declaringType = field.getDeclaringType();
StringConcatenation _builder = new StringConcatenation();
_builder.append("get");
String _simpleName = field.getSimpleName();
String _firstUpper = StringExtensions.toFirstUpper(_simpleName);
_builder.append(_firstUpper, "");
Signature _signature = CommonQueries.signature(_builder.toString());
return CommonQueries.hasExecutable(((ClassDeclaration) _declaringType), _signature);
}
示例13: hasSetter
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public static boolean hasSetter(final FieldDeclaration field) {
TypeDeclaration _declaringType = field.getDeclaringType();
StringConcatenation _builder = new StringConcatenation();
_builder.append("set");
String _simpleName = field.getSimpleName();
String _firstUpper = StringExtensions.toFirstUpper(_simpleName);
_builder.append(_firstUpper, "");
TypeReference _type = field.getType();
Signature _signature = CommonQueries.signature(_builder.toString(), _type);
return CommonQueries.hasExecutable(((ClassDeclaration) _declaringType), _signature);
}
示例14: persistentState
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
/**
* All non-static, non-transient fields of this class
*/
public static Iterable<? extends FieldDeclaration> persistentState(final ClassDeclaration cls) {
Iterable<? extends FieldDeclaration> _declaredFields = cls.getDeclaredFields();
final Function1<FieldDeclaration, Boolean> _function = (FieldDeclaration it) -> {
return Boolean.valueOf(((!it.isTransient()) && (!it.isStatic())));
};
return IterableExtensions.filter(_declaredFields, _function);
}
示例15: packageName
import org.eclipse.xtend.lib.macro.declaration.ClassDeclaration; //导入依赖的package包/类
public static String packageName(final ClassDeclaration cls) {
String _xblockexpression = null;
{
String _qualifiedName = cls.getQualifiedName();
final String[] parts = _qualifiedName.split("\\.");
int _size = ((List<String>)Conversions.doWrapArray(parts)).size();
int _minus = (_size - 1);
Iterable<String> _take = IterableExtensions.<String>take(((Iterable<String>)Conversions.doWrapArray(parts)), _minus);
_xblockexpression = IterableExtensions.join(_take, ".");
}
return _xblockexpression;
}