com.xdev.jadoth.codegen.java.codeobjects.JavaFieldDescription Maven / Gradle / Ivy
/**
*
*/
package com.xdev.jadoth.codegen.java.codeobjects;
/*-
* #%L
* XDEV Application Framework
* %%
* Copyright (C) 2003 - 2020 XDEV Software
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
/**
* @author Thomas Muenz
*
*/
public interface JavaFieldDescription extends JavaAccessibleObjectDescription, JavaTypeMemberDescription
{
public JavaExpression getInitialExpression();
public class Implemenatation extends JavaModifierableCompilationObjectDescription.Implementation
implements JavaFieldDescription
{
///////////////////////////////////////////////////////////////////////////
// instance fields //
/////////////////////
private JavaTypeDefinition owner = null;
private boolean ownerIsClass = false;
private JavaExpression initialExpression;
private JavaTypeDescription type;
///////////////////////////////////////////////////////////////////////////
// constructors //
/////////////////////
Implemenatation(
final int modifiers,
final JavaTypeDescription type,
final String name,
final JavaExpression initialExpression
)
{
super(modifiers, name);
this.type = type;
this.initialExpression = initialExpression;
}
///////////////////////////////////////////////////////////////////////////
// getters //
/////////////////////
/**
* @return
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaFieldDescription#getInitialExpression()
*/
@Override
public JavaExpression getInitialExpression()
{
return this.initialExpression;
}
/**
* @return
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaClassMemberDefinition#getOwnerClass()
*/
@Override
public JavaClassDefinition getOwnerClass()
{
return this.ownerIsClass ?(JavaClassDefinition)this.owner :null;
}
/**
* @return
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaTypeMemberDefinition#getOwnerType()
*/
@Override
public JavaTypeDefinition getOwnerType()
{
return this.owner;
}
/**
* @return the type
*/
public JavaTypeDescription getType()
{
return type;
}
///////////////////////////////////////////////////////////////////////////
// setters //
/////////////////////
/**
* @param initialExpression
* @return
* @see net.jadoth.codegeneration.java.codeobjects.JavaFieldDescription#setInitialExpression(net.jadoth.codegeneration.java.codeobjects.JavaExpression)
*/
/**
* @param type the type to set
*/
public void setType(final JavaTypeDescription type)
{
this.type = type;
}
/**
* @param modifier
* @return
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaModifierableCompilationObjectDefinition.Implementation#isValidModifier(int)
*/
@Override
protected boolean isValidModifier(final int modifier)
{
return false;
}
/**
* @return
* @see com.xdev.jadoth.util.strings.Named#getName()
*/
@Override
public String getName()
{
return null;
}
/**
* @return
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaModifierableCompilationObjectDescription#getModifiers()
*/
@Override
public int getModifiers()
{
return 0;
}
/**
* @return always null
* @see java.lang.reflect.Member#getDeclaringClass()
*/
@Override
public Class> getDeclaringClass()
{
// (17.06.2010)XXX maybe JavaFieldDescription.getDeclaringClass() makes sense?
return null;
}
/**
* @return always false
* @see java.lang.reflect.Member#isSynthetic()
*/
@Override
public boolean isSynthetic()
{
return false;
}
/**
* @return
*/
@Override
public int getNestingLevel()
{
if(this.owner == null) return 0;
return this.owner.getNestingLevel()+1;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy